changeset 2337:1d85514968a2

Fix remaining excessive white space characters.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Wed, 04 Jul 2007 12:12:00 +0200
parents 10be78f1fa97
children dbfe98af770a
files MoinMoin/_tests/test_events.py MoinMoin/config/multiconfig.py MoinMoin/events/__init__.py MoinMoin/events/jabbernotify.py MoinMoin/events/notification.py jabberbot/xmlrpcbot.py jabberbot/xmppbot.py
diffstat 7 files changed, 248 insertions(+), 248 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_events.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/MoinMoin/_tests/test_events.py	Wed Jul 04 12:12:00 2007 +0200
@@ -29,7 +29,7 @@
 
     request.cfg.event_handlers = [event_handler]
     event = events.Event(request)
-    
+
     print "A proper event handler must be called and an 1-element list of results returned"
     results = events.send_event(event)
     assert issubclass(results[0].__class__, events.EventResult)
@@ -42,11 +42,11 @@
 
 def test_page_change_message(request):
     page = Page(request, "FrontPage")
-    
+
     print "Provided with a dumb change type argument, this should raise an exception!"
-    py.test.raises(notification.UnknownChangeType, notification.page_change_message, 
+    py.test.raises(notification.UnknownChangeType, notification.page_change_message,
                    "StupidType", request, page, "en", revisions=page.getRevList())
-    
+
 def test_filter_subscriber_list(request):
     user = User(request)
     event = events.Event(request)
@@ -66,7 +66,7 @@
     subscribers = {"en": [user]}
     jabbernotify._filter_subscriber_list(event, subscribers)
     assert not subscribers["en"]
-   
+
     print "User is not subscribed to this event, but wants to get notfied by jabber."
     print "The list should be empty."
     user.notify_by_jabber = True
--- a/MoinMoin/config/multiconfig.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/MoinMoin/config/multiconfig.py	Wed Jul 04 12:12:00 2007 +0200
@@ -695,7 +695,7 @@
             self.notification_server = Server(self.notification_bot_uri, )
 
             # Add checkbox fields that allow user to select means of notification
-            self.user_checkbox_fields.extend([ 
+            self.user_checkbox_fields.extend([
                   ('notify_by_email', lambda _: _('Notify me about changes via email')),
                   ('notify_by_jabber', lambda _: _('Notify me about changes via jabber')),
                   ])
@@ -741,7 +741,7 @@
         return property(getter)
     iwid = make_iwid_property("_iwid")
     iwid_full = make_iwid_property("_iwid_full")
-    
+
     # lazily load a list of events a user can subscribe to
     def make_subscribable_events_prop():
         def getter(self):
--- a/MoinMoin/events/__init__.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/MoinMoin/events/__init__.py	Wed Jul 04 12:12:00 2007 +0200
@@ -40,19 +40,19 @@
 
     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):
-    
+
     description = u"""Page has been renamed"""
     req_superuser = False
-    
+
     def __init__(self, request, page, old_page, comment):
         PageEvent.__init__(self, request)
         self.page = page
@@ -61,10 +61,10 @@
 
 
 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
@@ -73,10 +73,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
@@ -86,68 +86,68 @@
 
 
 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
-        
+
 class EventResult:
     """ This is a base class for messages passed from event handlers """
     pass
-        
+
 def get_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? ;-)
-    
+
     """
     event_handlers = []
     names = wikiutil.getPlugins("events", cfg)
@@ -157,41 +157,41 @@
             handler = wikiutil.importPlugin(cfg, "events", name, "handle")
         except PluginAttributeError:
             handler = None
-        
+
         if handler is not None:
             event_handlers.append(handler)
-            
+
     return event_handlers
 
 
 def send_event(event):
     """Function called from outside to process an event
-    
+
     @return: a list of messages returned by handlers
     @rtype: list
     """
-   
+
     # A list of messages generated by event handlers, passed back to caller
     msg = []
     cfg = event.request.cfg
-    
+
     # Try to handle the event with each available handler (for now)
     for handle in cfg.event_handlers:
         retval = handle(event)
         if retval:
             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
     """
     defs = globals()
-    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,
--- a/MoinMoin/events/jabbernotify.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/MoinMoin/events/jabbernotify.py	Wed Jul 04 12:12:00 2007 +0200
@@ -54,7 +54,7 @@
         if isinstance(event, ev.JabberIDSetEvent):
             server.addJIDToRoster(request.cfg.secret, event.jid)
         else:
-            server.removeJIDFromRoster(request.cfg.secret, event.jid)        
+            server.removeJIDFromRoster(request.cfg.secret, event.jid)
 
     except xmlrpclib.Error, err:
         ev.logger.error(_("XML RPC error: %s"), str(err))
@@ -100,7 +100,7 @@
     request = event.request
     page = event.page
 
-    subscribers = page.getSubscribers(request, return_users=1, trivial=event.trivial)    
+    subscribers = page.getSubscribers(request, return_users=1, trivial=event.trivial)
     _filter_subscriber_list(event, subscribers)
     return page_change("page_changed", request, page, subscribers, \
                        revisions=page.getRevList(), comment=event.comment)
--- a/MoinMoin/events/notification.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/MoinMoin/events/notification.py	Wed Jul 04 12:12:00 2007 +0200
@@ -47,34 +47,34 @@
 
 def page_change_message(msgtype, request, page, lang, **kwargs):
     """Prepare a notification text for a page change of given type
-    
+
     @param msgtype: a type of message to send (page_changed, attachment_added, ...)
     @type msgtype: str or unicode
     @param **kwargs: a dictionary of additional parameters, which depend on msgtype
-    
+
     @return: a formatted, ready to send message
     @rtype: unicode
-    
+
     """
     from MoinMoin.action.AttachFile import getAttachUrl
-    
+
     _ = request.getText
     page._ = lambda s, formatted=True, r=request, l=lang: r.getText(s, formatted=formatted, lang=l)
     querystr = {}
-    
-    if msgtype == "page_changed": 
+
+    if msgtype == "page_changed":
         revisions = kwargs['revisions']
         if len(kwargs['revisions']) >= 2:
             querystr = {'action': 'diff',
                     'rev2': str(revisions[0]),
                     'rev1': str(revisions[1])}
-        
+
     if msgtype == "attachment_added":
         attachlink = request.getBaseURL() + \
                         getAttachUrl(page.page_name, kwargs['attach_name'], request)
-        
+
     pagelink = request.getQualifiedURL(page.url(request, querystr, relative=False))
-    
+
     if msgtype == "page_changed":
         messageBody = _("Dear Wiki user,\n\n"
         'You have subscribed to a wiki page or wiki category on "%(sitename)s" for change notification.\n\n'
@@ -84,7 +84,7 @@
             'pagelink': pagelink,
             'sitename': page.cfg.sitename or request.getBaseURL(),
         }
-            
+
         # append a diff (or append full page text if there is no diff)
         if len(revisions) < 2:
             messageBody = messageBody + \
@@ -97,7 +97,7 @@
                 messageBody = messageBody + "%s\n%s\n" % (("-" * 78), '\n'.join(lines))
             else:
                 messageBody = messageBody + _("No differences found!\n", formatted=False)
-                
+
     elif msgtype == "attachment_added":
         messageBody = _("Dear Wiki user,\n\n"
         'You have subscribed to a wiki page "%(sitename)s" for change notification.\n\n'
@@ -113,7 +113,7 @@
             'attach_size': kwargs['attach_size'],
             'attach_get': attachlink,
         }
-        
+
     elif msgtype == "page_deleted":
         messageBody = _("Dear wiki user,\n\n"
             'You have subscribed to a wiki page "%(sitename)s" for change notification.\n\n'
@@ -123,7 +123,7 @@
                 'pagelink': pagelink,
                 'sitename': page.cfg.sitename or request.getBaseURL(),
         }
-            
+
     elif msgtype == "page_renamed":
         messageBody = _("Dear wiki user,\n\n"
             'You have subscribed to a wiki page "%(sitename)s" for change notification.\n\n'
@@ -136,10 +136,10 @@
         }
     else:
         raise UnknownChangeType()
-    
+
     if 'comment' in kwargs and kwargs['comment'] is not None:
         messageBody = messageBody + \
             _("The comment on the change is:\n%(comment)s", formatted=False) % {'comment': kwargs['comment']}
-            
+
     return messageBody
-    
+
--- a/jabberbot/xmlrpcbot.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/jabberbot/xmlrpcbot.py	Wed Jul 04 12:12:00 2007 +0200
@@ -53,13 +53,13 @@
                 self.execute_command(command)
             except Queue.Empty:
                 pass
-            
+
     def create_connection(self):
         return xmlrpclib.ServerProxy(self.url, allow_none=True, verbose=self.config.verbose)
-                
+
     def execute_command(self, command):
         """Execute commands coming from the XMPP component"""
-        
+
         # FIXME: make this kind of automatic
         if isinstance(command, cmd.GetPage):
             self.get_page(command)
@@ -69,30 +69,30 @@
             self.get_page_list(command)
         elif isinstance(command, cmd.GetPageInfo):
             self.get_page_info(command)
-    
+
     def get_auth_token(self, jid):
         token = self.connection.getAuthToken(jid, self.config.secret)
         if token:
             self.token = token
-                
+
     def _xmlrpc_decorator(function):
         """A decorator function, which adds some maintenance code
-        
+
         This function takes care of preparing a MultiCall object and
         an authentication token, and deleting them at the end.
-        
+
         """
         def wrapped_func(self, command):
             self.token = None
             self.multicall = MultiCall(self.connection)
             jid = command.jid
-            
+
             try:
                 try:
                     self.get_auth_token(command.jid)
                     if self.token:
                         self.multicall.applyAuthToken(self.token)
-                        
+
                     function(self, command)
                     self.commands_out.put_nowait(command)
                 except xmlrpclib.Fault, fault:
@@ -103,18 +103,18 @@
                     msg = u"""A serious error occured while processing your request:\n%s"""
                     notification = cmd.NotificationCommand([jid], msg % (str(err), ))
                     self.commands_out.put_nowait(notification)
-                    
+
             finally:
                 del self.token
                 del self.multicall
-                
+
         return wrapped_func
-    
+
     def get_page(self, command):
         """Returns a raw page"""
-        
+
         self.multicall.getPage(command.pagename)
-        
+
         if not self.token:
             # FIXME: notify the user that he may not have full rights on the wiki
             getpage_result = self.multicall()
@@ -123,36 +123,36 @@
 
         # FIXME: warn if token turned out being wrong
         command.data = getpage_result[0]
-            
+
     get_page = _xmlrpc_decorator(get_page)
-        
-        
+
+
     def get_page_html(self, command):
         """Returns a html-formatted page"""
-        
+
         self.multicall.getPageHTML(command.pagename)
-        
+
         if not self.token:
-            # FIXME: notify the user that he may not have full rights on the wiki    
+            # FIXME: notify the user that he may not have full rights on the wiki
             getpagehtml_result = self.multicall()
         else:
             token_result, getpagehtml_result = self.multicall()
 
         # FIXME: warn if token turned out being wrong
         command.data = getpagehtml_result[0]
-            
+
     get_page_html = _xmlrpc_decorator(get_page_html)
-        
-        
+
+
     def get_page_list(self, command):
         """Returns a list of all accesible pages"""
-        
+
         txt = u"""This command may take a while to complete, please be patient..."""
         info = cmd.NotificationCommand([command.jid], txt)
         self.commands_out.put_nowait(info)
-        
+
         self.multicall.getAllPages()
-        
+
         if not self.token:
             # FIXME: notify the user that he may not have full rights on the wiki
             getpagelist_result = self.multicall()
@@ -161,27 +161,27 @@
 
         # FIXME: warn if token turned out being wrong
         command.data = getpagelist_result[0]
-            
+
     get_page_list = _xmlrpc_decorator(get_page_list)
-    
-    
+
+
     def get_page_info(self, command):
         """Returns detailed information about a given page"""
-        
+
         self.multicall.getPageInfo(command.pagename)
-        
+
         if not self.token:
             # FIXME: notify the user that he may not have full rights on the wiki
             getpageinfo_result = self.multicall()
         else:
             token_result, getpageinfo_result = self.multicall()
-        
+
         # FIXME: warn if token turned out being wrong
-        
+
         author = getpageinfo_result[0]['author']
         if author.startswith("Self:"):
             author = getpageinfo_result[0]['author'][5:]
-        
+
         datestr = str(getpageinfo_result[0]['lastModified'])
         date = u"%(year)s-%(month)s-%(day)s at %(time)s" % {
                     'year': datestr[:4],
@@ -189,7 +189,7 @@
                     'day': datestr[6:8],
                     'time': datestr[9:17],
                 }
-        
+
         msg = u"""Last author: %(author)s
 Last modification: %(modification)s
 Current version: %(version)s""" % {
@@ -197,54 +197,54 @@
              'modification': date,
              'version': getpageinfo_result[0]['version'],
          }
-        
+
         command.data = msg
-        
+
     get_page_info = _xmlrpc_decorator(get_page_info)
 
 
 class XMLRPCServer(Thread):
     """XMLRPC Server
-    
+
     It waits for notifications requests coming from wiki,
     creates command objects and puts them on a queue for
     later processing by the XMPP component
-    
+
     @param commands: an input command queue
     """
-    
+
     def __init__(self, config, commands):
         Thread.__init__(self)
         self.commands = commands
         self.verbose = config.verbose
         self.log = logging.getLogger("log")
-        
+
         if config.secret:
             self.secret = config.secret
         else:
             error = "You must set a (long) secret string"
             self.log.critical(error)
             raise ConfigurationError(error)
-        
+
         self.server = SimpleXMLRPCServer((config.xmlrpc_host, config.xmlrpc_port))
-        
+
     def run(self):
         """Starts the server / thread"""
-        
-        # Register methods having an "export" attribute as XML RPC functions and 
+
+        # Register methods having an "export" attribute as XML RPC functions and
         # decorate them with a check for a shared (wiki-bot) secret.
         items = self.__class__.__dict__.items()
-        methods = [(name, func) for (name, func) in items if callable(func) 
+        methods = [(name, func) for (name, func) in items if callable(func)
                    and "export" in func.__dict__]
 
         for name, func in methods:
             self.server.register_function(self.secret_check(func), name)
-        
+
         self.server.serve_forever()
 
     def secret_check(self, function):
         """Adds a check for a secret to a given function
-        
+
         Using this one does not have to worry about checking for the secret
         in every XML RPC function.
         """
@@ -253,42 +253,42 @@
                 raise xmlrpclib.Fault(1, "You are not allowed to use this bot!")
             else:
                 return function(self, *args)
-            
+
         return protected_func
-    
-    
+
+
     def send_notification(self, jids, text):
         """Instructs the XMPP component to send a notification
-        
+
         @param jids: a list of JIDs to send a message to (bare JIDs)
         @type jids: a list of str or unicode
         @param text: a message body
         @type text: unicode
-        
+
         """
         command = cmd.NotificationCommand(jids, text)
         self.commands.put_nowait(command)
         return True
     send_notification.export = True
-    
+
     def addJIDToRoster(self, jid):
         """Instructs the XMPP component to add a new JID to its roster
-        
+
         @param jid: a jid to add, this must be a bare jid
-        @type jid: str or unicode, 
-        
-        """  
+        @type jid: str or unicode,
+
+        """
         command = cmd.AddJIDToRosterCommand(jid)
         self.commands.put_nowait(command)
         return True
     addJIDToRoster.export = True
-    
+
     def removeJIDFromRoster(self, jid):
         """Instructs the XMPP component to remove a JID from its roster
-        
+
         @param jid: a jid to remove, this must be a bare jid
         @type jid: str or unicode
-        
+
         """
         command = cmd.RemoveJIDFromRosterCommand(jid)
         self.commands.put_nowait(command)
--- a/jabberbot/xmppbot.py	Wed Jul 04 12:10:11 2007 +0200
+++ b/jabberbot/xmppbot.py	Wed Jul 04 12:12:00 2007 +0200
@@ -43,53 +43,53 @@
 
         """
         self.resources[resource] = {'show': show, 'priority': priority}
-    
+
     def remove_resource(self, resource):
         """Removes information about a connected resource
-        
+
         @param resource: resource name
-        
+
         """
         if self.resources.has_key(resource):
             del self.resources[resource]
         else:
             raise ValueError("No such resource!")
-        
+
     def is_dnd(self):
         """Checks if contact is DoNotDisturb
-        
+
         The contact is DND if its resource with the highest priority is DND
-        
-        """      
+
+        """
         # Priority can't be lower than -128
         max_prio = -129
         max_prio_show = u"dnd"
-        
+
         for resource in self.resources.itervalues():
             # TODO: check RFC for behaviour of 2 resources with the same priority
             if resource['priority'] > max_prio:
                 max_prio = resource['priority']
                 max_prio_show = resource['show']
-                
+
         return max_prio_show == u'dnd'
-        
+
     def set_show(self, resource, show):
         """Sets show property for a given resource
-        
+
         @param resource: resource to alter
         @param show: new value of the show property
         @raise ValueError: no resource with given name has been found
-        
+
         """
         if self.resources.has_key(resource):
             self.resources[resource]['show'] = show
         else:
             raise ValueError("There's no such resource")
-    
+
     def uses_resource(self, resource):
         """Checks if contact uses a given resource"""
         return self.resources.has_key(resource)
-        
+
     def __str__(self):
         retval = "%s (%s) has %d queued messages"
         res = ", ".join([name + " is " + res['show'] for name, res in self.resources.items()])
@@ -98,63 +98,63 @@
 
 class XMPPBot(Client, Thread):
     """A simple XMPP bot"""
-       
+
     def __init__(self, config, from_commands, to_commands):
         """A constructor
-        
+
         @param from_commands: a Queue object used to send commands to other (xmlrpc) threads
         @param to_commands: a Queue object used to receive commands from other threads
-        
+
         """
         Thread.__init__(self)
-        
+
         self.from_commands = from_commands
-        self.to_commands = to_commands   
+        self.to_commands = to_commands
         jid = u"%s@%s/%s" % (config.xmpp_node, config.xmpp_server, config.xmpp_resource)
-        
+
         self.config = config
         self.log = logging.getLogger("log")
         self.jid = JID(node_or_jid=jid, domain=config.xmpp_server, resource=config.xmpp_resource)
         self.tlsconfig = TLSSettings(require = True, verify_peer=False)
-        
+
         # A dictionary of contact objects, ordered by bare JID
         self.contacts = {}
 
-        self.known_xmlrpc_cmds = [cmd.GetPage, cmd.GetPageHTML, cmd.GetPageList, cmd.GetPageInfo] 
+        self.known_xmlrpc_cmds = [cmd.GetPage, cmd.GetPageHTML, cmd.GetPageList, cmd.GetPageInfo]
         self.internal_commands = ["ping", "help"]
-        
+
         self.xmlrpc_commands = {}
         for command, name in [(command, command.__name__) for command in self.known_xmlrpc_cmds]:
             self.xmlrpc_commands[name] = command
-        
-        Client.__init__(self, self.jid, config.xmpp_password, config.xmpp_server, tls_settings=self.tlsconfig)   
-    
+
+        Client.__init__(self, self.jid, config.xmpp_password, config.xmpp_server, tls_settings=self.tlsconfig)
+
     def run(self):
         """Start the bot - enter the event loop"""
-        
-        self.log.info("Starting the jabber bot.")    
+
+        self.log.info("Starting the jabber bot.")
         self.connect()
         self.loop()
-        
+
     def loop(self, timeout=1):
         """Main event loop - stream and command handling"""
-        
+
         while 1:
             stream = self.get_stream()
             if not stream:
                 break
-            
+
             act = stream.loop_iter(timeout)
             if not act:
                 # Process all available commands
                 while self.poll_commands(): pass
                 self.idle()
-        
+
     def poll_commands(self):
         """Checks for new commands in the input queue and executes them
-        
+
         @return: True if any command has been executed, False otherwise.
-        
+
         """
         try:
             command = self.to_commands.get_nowait()
@@ -162,14 +162,14 @@
             return True
         except Queue.Empty:
             return False
-        
+
     def handle_command(self, command, ignore_dnd=False):
         """Excecutes commands from other components
-        
+
         @param command: a command to execute
         @type command: any class defined in commands.py (FIXME?)
         @param ignore_dnd: if command results in user interaction, should DnD be ignored?
-        
+
         """
         # Handle normal notifications
         if isinstance(command, cmd.NotificationCommand):
@@ -177,8 +177,8 @@
                 jid = JID(recipient)
                 jid_text = jid.bare().as_utf8()
                 text = command.text
-                
-                # Check if contact is DoNotDisturb. 
+
+                # Check if contact is DoNotDisturb.
                 # If so, queue the message for delayed delivery.
                 try:
                     contact = self.contacts[jid_text]
@@ -187,100 +187,100 @@
                         return
                 except KeyError:
                     pass
-                
+
                 self.send_message(jid, text)
-            
+
         # Handle subscribtion management commands
         if isinstance(command, cmd.AddJIDToRosterCommand):
             jid = JID(node_or_jid=command.jid)
             self.ask_for_subscription(jid)
-            
+
         elif isinstance(command, cmd.RemoveJIDFromRosterCommand):
             jid = JID(node_or_jid=command.jid)
             self.remove_subscription(jid)
-            
+
         elif isinstance(command, cmd.GetPage) or isinstance(command, cmd.GetPageHTML):
             msg = u"""Here's the page "%s" that you've requested:\n\n%s"""
             self.send_message(command.jid, msg % (command.pagename, command.data))
-        
+
         elif isinstance(command, cmd.GetPageList):
             msg = u"""That's the list of pages accesible to you:\n\n%s"""
             pagelist = "\n".join(command.data)
             self.send_message(command.jid, msg % (pagelist, ))
-            
+
         elif isinstance(command, cmd.GetPageInfo):
             msg = u"""Following detailed information on page "%s" is available::\n\n%s"""
             self.send_message(command.jid, msg % (command.pagename, command.data))
-            
+
     def ask_for_subscription(self, jid):
         """Sends a <presence/> stanza with type="subscribe"
-        
+
         Bot tries to subscribe to every contact's presence, so that
         it can honor special cases, like DoNotDisturb setting.
-        
+
         @param jid: Jabber ID of entity we're subscribing to
         @type jid: pyxmpp.jid.JID
-        
+
         """
         stanza = Presence(to_jid=jid, stanza_type="subscribe")
         self.get_stream().send(stanza)
-        
+
     def remove_subscription(self, jid):
         """Sends a <presence/> stanza with type="unsubscribed
-        
+
         @param jid: Jabber ID of entity whose subscription we cancel
         @type jid: JID
-        
+
         """
         stanza = Presence(to_jid=jid, stanza_type="unsubscribed")
         self.get_stream().send(stanza)
-        
+
     def send_message(self, jid, text, msg_type=u"chat"):
         """Sends a message
-        
+
         @param jid: JID to send the message to
-        @param text: message's body: 
+        @param text: message's body:
         @param type: message type, as defined in RFC
         @type jid: pyxmpp.jid.JID
-        
+
         """
         message = Message(to_jid=jid, body=text, stanza_type=msg_type)
         self.get_stream().send(message)
-    
+
     def handle_message(self, message):
         """Handles incoming messages
-        
+
         @param message: a message stanza to parse
         @type message: pyxmpp.message.Message
-        
-        """    
+
+        """
         if self.config.verbose:
             msg = "Message from %s." % (message.get_from_jid().as_utf8(), )
             self.log.debug(msg)
-            
+
         text = message.get_body()
         sender = message.get_from_jid()
         command = text.split()
-        
+
         # Ignore empty commands
         if not command:
             return
-        
+
         if command[0] in self.internal_commands:
             response = self.handle_internal_command(command)
         elif command[0] in self.xmlrpc_commands.keys():
             response = self.handle_xmlrpc_command(sender, command)
         else:
             response = self.reply_help()
-        
+
         if not response == u"":
             self.send_message(sender, response)
-            
+
     def handle_internal_command(self, command):
         """Handles internal commands, that can be completed by the XMPP bot itself
-        
+
         @param command: list representing a command
-        
+
         """
         if command[0] == "ping":
             return "pong"
@@ -292,127 +292,127 @@
         else:
             # For unknown command return a generic help message
             return self.reply_help()
-        
+
     def help_on(self, command):
         """Returns a help message on a given topic
-        
+
         @param command: a command to describe in a help message
         @type command: str or unicode
         @return: a help message
-        
+
         """
         if command == "help":
             return u"""The "help" command prints a short, helpful message about a given topic or function.\n\nUsage: help [topic_or_function]"""
-        
+
         elif command == "ping":
             return u"""The "ping" command returns a "pong" message as soon as it's received."""
-        
+
         # Here we have to deal with help messages of external (xmlrpc) commands
         else:
             classobj = self.xmlrpc_commands[command]
             help_str = u"%s - %s\n\nUsage: %s %s"
             return help_str % (command, classobj.description, command, classobj.parameter_list)
-        
-        
+
+
     def handle_xmlrpc_command(self, sender, command):
         """Creates a command object, and puts it the command queue
-        
+
         @param command: a valid name of available xmlrpc command
         @type command: list representing a command, name and parameters
-        
+
         """
         command_class = self.xmlrpc_commands[command[0]]
-        
+
         # Add sender's JID to the argument list
         command.insert(1, sender.as_utf8())
-        
+
         try:
             instance = command_class.__new__(command_class)
             instance.__init__(*command[1:])
             self.from_commands.put_nowait(instance)
-            
+
         # This happens when user specifies wrong parameters
         except TypeError:
             msg = u"You've specified a wrong parameter list. The call should look like:\n\n%s %s"
             return msg % (command[0], command_class.parameter_list)
-            
+
     def handle_unsubscribed_presence(self, stanza):
         """Handles unsubscribed presence stanzas"""
-        
+
         # FiXME: what policy should we adopt in this case?
         pass
-    
+
     def handle_subscribe_presence(self, stanza):
         """Handles subscribe presence stanzas (requests)"""
-        
+
         # FIXME: Let's just accept all subscribtion requests for now
         response = stanza.make_accept_response()
         self.get_stream().send(response)
-        
+
     def handle_unavailable_presence(self, stanza):
         """Handles unavailable presence stanzas
-        
+
         @type stanza: pyxmpp.presence.Presence
-        
+
         """
         self.log.debug("Handling unavailable presence.")
-        
+
         jid = stanza.get_from_jid()
         bare_jid = jid.bare().as_utf8()
-        
+
         # If we get presence, this contact should already be known
-        if bare_jid in self.contacts:    
+        if bare_jid in self.contacts:
             contact = self.contacts[bare_jid]
-            
+
             if self.config.verbose:
                 self.log.debug("%s, going OFFLINE." % contact)
-            
+
             try:
-                # Send queued messages now, as we can't guarantee to be 
+                # Send queued messages now, as we can't guarantee to be
                 # alive the next time this contact becomes available.
-                if len(contact.resources) == 1:    
+                if len(contact.resources) == 1:
                     self.send_queued_messages(contact, ignore_dnd=True)
                     del self.contacts[bare_jid]
                 else:
                     contact.remove_resource(jid.resource)
-                    
+
                     # The highest-priority resource, which used to be DnD might
                     # have gone offline. If so, try to deliver messages now.
                     if not contact.is_dnd():
                         self.send_queued_messages(contact)
-                    
+
             except ValueError:
                 self.log.error("Unknown contact (resource) going offline...")
-            
+
         else:
             self.log.error("Unavailable presence from unknown contact.")
-                
+
         # Confirm that we've handled this stanza
         return True
-    
+
     def handle_available_presence(self, presence):
         """Handles available presence stanzas
-        
+
         @type presence: pyxmpp.presence.Presence
-        
+
         """
         self.log.debug("Handling available presence.")
-        
+
         show = presence.get_show()
         if show is None:
             show = u'available'
-            
+
         priority = presence.get_priority()
         jid = presence.get_from_jid()
         bare_jid = jid.bare().as_utf8()
-               
-        if bare_jid in self.contacts:    
-            contact = self.contacts[bare_jid]              
-                
+
+        if bare_jid in self.contacts:
+            contact = self.contacts[bare_jid]
+
             # The resource is already known, so update it
             if contact.uses_resource(jid.resource):
                 contact.set_show(jid.resource, show)
-            
+
             # Unknown resource, add it to the list
             else:
                 contact.add_resource(jid.resource, show, priority)
@@ -423,75 +423,75 @@
             # Either way check, if we can deliver queued messages now
             if not contact.is_dnd():
                 self.send_queued_messages(contact)
-                
+
         else:
             self.contacts[bare_jid] = Contact(jid, jid.resource, priority, show)
             self.log.debug(self.contacts[bare_jid])
-        
+
         # Confirm that we've handled this stanza
         return True
-    
+
     def send_queued_messages(self, contact, ignore_dnd=False):
         """Sends messages queued for the contact
-        
+
         @param contact: a contact whose queued messages are to be sent
         @type contact: jabberbot.xmppbot.Contact
         @param ignore_dnd: should contact's DnD status be ignored?
-        
+
         """
         for command in contact.messages:
             self.handle_command(command, ignore_dnd)
-                    
+
     def reply_help(self):
         """Constructs a generic help message
-        
+
         It's sent in response to an uknown message or the "help" command.
-        
+
         """
         msg = u"""Hello there! I'm a MoinMoin Notification Bot. Available commands:\n\n%s\n%s"""
         internal = ", ".join(self.internal_commands)
         xmlrpc = ", ".join(self.xmlrpc_commands.keys())
-        
+
         return msg % (internal, xmlrpc)
-    
+
     def authenticated(self):
         """Called when authentication succeedes"""
         self.log.info("Authenticated.")
-            
+
     def authorized(self):
         """Called when authorization succeedes"""
-        
+
         self.log.info("Authorized.")
-        
+
         stream = self.get_stream()
         stream.set_message_handler("normal", self.handle_message)
         stream.set_presence_handler("available", self.handle_available_presence)
         stream.set_presence_handler("unavailable", self.handle_unavailable_presence)
         stream.set_presence_handler("unsubscribed", self.handle_unsubscribed_presence)
         stream.set_presence_handler("subscribe", self.handle_subscribe_presence)
-        
+
         self.request_session()
-            
+
     def connected(self):
         """Called when connections has been established"""
         self.log.info("Connected.")
-            
+
     def disconnected(self):
         """Called when disconnection occurs"""
         self.log.info("Disconnected.")
-            
+
     def roster_updated(self, item=None):
         """Called when roster gets updated"""
         self.log.debug("Updating roster.")
-            
+
     def stream_closed(self, stream):
         """Called when stream closes"""
         self.log.debug("Stream closed.")
-            
+
     def stream_created(self, stream):
         """Called when stream gets created"""
         self.log.debug("Stream created.")
-            
+
     def stream_error(self, error):
         """Called when stream error gets received"""
         self.log.error("Received a stream error.")