diff MoinMoin/events/__init__.py @ 2286:01f05e74aa9c

Big PEP8 and whitespace cleanup
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 02 Jul 2007 23:33:20 +0200
parents cf4c4a3d6085
children 10be78f1fa97
line wrap: on
line diff
--- a/MoinMoin/events/__init__.py	Mon Jul 02 20:46:01 2007 +0200
+++ b/MoinMoin/events/__init__.py	Mon Jul 02 23:33:20 2007 +0200
@@ -29,34 +29,34 @@
     def __init__(self, request):
         self.request = request
 
-        
+
 class PageEvent(Event):
     """An event related to a page change"""
     def __init__(self, request):
         Event.__init__(self, request)
 
-        
+
 class PageChangedEvent(PageEvent):
-    
+
     description = u"""Page has been modified (edit, creation, deletion)"""
     req_superuser = False
-    
+
     def __init__(self, request, page, comment, trivial):
         PageEvent.__init__(self, request)
         self.page = page
         self.comment = comment
         self.trivial = trivial
 
-        
+
 class PageRenamedEvent(PageEvent):
     pass
 
 
 class PageDeletedEvent(PageEvent):
-    
+
     description = u"""Page has been deleted"""
     req_superuser = False
-    
+
     def __init__(self, request, page, comment):
         PageEvent.__init__(self, request)
         self.request = request
@@ -65,10 +65,10 @@
 
 
 class FileAttachedEvent(PageEvent):
-    
+
     description = u"""A new attachment has been added"""
     req_superuser = False
-    
+
     def __init__(self, request, pagename, attachment_name, size):
         PageEvent.__init__(self, request)
         self.request = request
@@ -78,64 +78,64 @@
 
 
 class PageRevertedEvent(PageEvent):
-    
+
     description = u"""A page has been reverted to a previous state"""
     req_superuser = False
-    
+
     def __init__(self, request, pagename, previous, current):
         PageEvent.__init__(self, request)
         self.pagename = pagename
         self.previous = previous
-        self.current = current    
+        self.current = current
 
 
 class SubscribedToPageEvent(PageEvent):
-    
+
     description = u"""An user has subscribed to a page"""
     req_superuser = True
-    
+
     def __init__(self, request, pagename, username):
-        PageEvent.__init__(self, request)    
+        PageEvent.__init__(self, request)
         self.pagename = pagename
         self.username = username
 
 
 class JabberIDSetEvent(Event):
     """ Sent when user changes her Jabber ID """
-    
+
     def __init__(self, request, jid):
         Event.__init__(self, request)
         self.jid = jid
-        
+
 class JabberIDUnsetEvent(Event):
     """ Sent when Jabber ID is no longer used
-    
+
     Obviously this will be usually sent along with JabberIDSetEvent,
     because we require user's jabber id to be unique by default.
-    
+
     """
     def __init__(self, request, jid):
         Event.__init__(self, request)
         self.jid = jid
-        
+
 class UserCreatedEvent(Event):
     """ Sent when a new user has been created """
-    
+
     description = u"""A new account has been created"""
     req_superuser = True
-    
+
     def __init__(self, request, user):
         Event.__init__(self, request)
         self.user = user
-        
+
 def _register_handlers(cfg):
     """Create a list of available event handlers.
-    
+
     Each handler is a handle() function defined in an plugin,
     pretty much like in case of actions.
-    
+
     TODO: maybe make it less dumb? ;-)"""
-    
+
     global _event_handlers
 
     _event_handlers = []
@@ -146,44 +146,44 @@
             handler = wikiutil.importPlugin(cfg, "events", name, "handle")
         except PluginAttributeError:
             handler = None
-        
+
         if handler is not None:
             _event_handlers.append(handler)
 
 
 def send_event(event):
     """Function called from outside to process an event"""
-   
+
     # A list of messages generated by event handlers, passed back to caller
     msg = []
-    
+
     # Find all available event handlers
     if _event_handlers is None:
         _register_handlers(event.request.cfg)
-    
+
     # Try to handle the event with each available handler (for now)
     for handle in _event_handlers:
         retval = handle(event)
         if isinstance(retval, unicode):
             msg.append(retval)
-            
+
     return msg
 
 def get_subscribable_events():
     """Create and return a list of user-visible events
-    
+
     @return: A list of user-visible events described by dictionaries
     @rtype: dict
     """
     global _subscribable_events
     defs = globals()
-    
+
     if not _subscribable_events:
         _subscribable_events = {}
-        
+
         for ev in defs.values():
             if type(ev) is type and issubclass(ev, Event) and ev.__dict__.has_key("description"):
                 _subscribable_events[ev.__name__] = {'desc': ev.description,
                                                      'superuser': ev.req_superuser}
-    
+
     return _subscribable_events