changeset 1004:7828d27399d4

whitespace-only cleanup and minor style changes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 22 Jul 2006 13:43:06 +0200
parents e8aef4cb2b34
children e1e1885deec1
files MoinMoin/util/__init__.py MoinMoin/util/bdiff.py MoinMoin/util/chartypes_create.py MoinMoin/util/diff.py MoinMoin/util/diff3.py MoinMoin/util/filesys.py MoinMoin/util/lock.py MoinMoin/util/profile.py MoinMoin/util/pysupport.py MoinMoin/util/thread_monitor.py MoinMoin/widget/base.py MoinMoin/widget/html.py MoinMoin/wikixml/marshal.py MoinMoin/xmlrpc/ProcessMail.py MoinMoin/xmlrpc/UpdateGroup.py MoinMoin/xmlrpc/__init__.py
diffstat 16 files changed, 156 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/util/__init__.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/__init__.py	Sat Jul 22 13:43:06 2006 +0200
@@ -31,7 +31,7 @@
     """
     new_string, num_subst = re.subn(g_undoUtf8Pattern, lambda m: m.group(1), text)
     new_string, num_subst = re.subn(g_cdataCharPattern, lambda m, d=g_charToEntity: d[m.group()], new_string)
-    new_string, num_subst = re.subn(g_xmlIllegalCharPattern, lambda m: '&#x%02X;'%ord(m.group()), new_string)
+    new_string, num_subst = re.subn(g_xmlIllegalCharPattern, lambda m: '&#x%02X;' % ord(m.group()), new_string)
     return new_string
 
 def TranslateText(text):
@@ -41,7 +41,7 @@
     """
     new_string, num_subst = re.subn(g_undoUtf8Pattern, lambda m: m.group(1), text)
     new_string, num_subst = re.subn(g_textCharPattern, lambda m, d=g_charToEntity: d[m.group()], new_string)
-    new_string, num_subst = re.subn(g_xmlIllegalCharPattern, lambda m: '&#x%02X;'%ord(m.group()), new_string)
+    new_string, num_subst = re.subn(g_xmlIllegalCharPattern, lambda m: '&#x%02X;' % ord(m.group()), new_string)
     return new_string
 
 
@@ -79,7 +79,7 @@
     result = '<dt><strong>Form entries</strong></dt>'
     for k in form.keys():
         v = form.get(k, ["<empty>"])
-        v = "|".join(v) 
+        v = "|".join(v)
         result = result + '<dd><em>%s</em>=%s</dd>' % (k, wikiutil.escape(v))
 
     return result
@@ -100,12 +100,12 @@
 
     def __init__(self):
         self.buffer = []
-        
+
     def write(self, foo):
         if not isinstance(foo, unicode):
             foo = foo.decode("iso-8859-1", "replace")
         self.buffer.append(foo)
-    
+
     def getvalue(self):
         return u''.join(self.buffer)
 
--- a/MoinMoin/util/bdiff.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/bdiff.py	Sat Jul 22 13:43:06 2006 +0200
@@ -30,17 +30,17 @@
 
     bin = []
     la = lb = 0
-    
+
     p = [0]
     for i in a: p.append(p[-1] + len(i))
-    
+
     for am, bm, size in difflib.SequenceMatcher(None, a, b).get_matching_blocks():
         s = "".join(b[lb:bm])
         if am > la or s:
             bin.append(struct.pack(BDIFF_PATT, p[la], p[am], len(s)) + s)
         la = am + size
         lb = bm + size
-    
+
     return "".join(bin)
 
 def textdiff(a, b):
@@ -78,12 +78,12 @@
 def test():
     a = ("foo\n" * 30)
     b = ("  fao" * 30)
-    
+
     a = file(r"C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Progra\Python\MoinMoin\moin-1.6-sync\MoinMoin\util\test.1").read()
     b = file(r"C:\Dokumente und Einstellungen\Administrator\Eigene Dateien\Progra\Python\MoinMoin\moin-1.6-sync\MoinMoin\util\test.2").read()
     a = a.splitlines(1)
     b = b.splitlines(1)
-    
+
     d = diff(a, b)
     z = compress(d)
     print `patchtext(d)`
--- a/MoinMoin/util/chartypes_create.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/chartypes_create.py	Sat Jul 22 13:43:06 2006 +0200
@@ -10,7 +10,7 @@
 lowercase = []
 digits = []
 space = []
-for code in range(1,65535):
+for code in range(1, 65535):
     c = unichr(code)
     str = "\\u%04x" % code
     if c.isupper():
--- a/MoinMoin/util/diff.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/diff.py	Sat Jul 22 13:43:06 2006 +0200
@@ -74,10 +74,10 @@
 %s:
 </td>
 </tr>
-""" % ( request.formatter.line_anchorlink(1, llineno) + request.formatter.text(t_line % llineno) + request.formatter.line_anchorlink(0),
-        request.formatter.line_anchorlink(1, rlineno) + request.formatter.text(t_line % rlineno) + request.formatter.line_anchorlink(0))
+""" % (request.formatter.line_anchorlink(1, llineno) + request.formatter.text(t_line % llineno) + request.formatter.line_anchorlink(0),
+       request.formatter.line_anchorlink(1, rlineno) + request.formatter.text(t_line % rlineno) + request.formatter.line_anchorlink(0))
 
-        leftpane  = ''
+        leftpane = ''
         rightpane = ''
         linecount = max(match[0] - lastmatch[0], match[1] - lastmatch[1])
         for line in range(linecount):
@@ -90,7 +90,7 @@
                     rightpane += '\n'
                 rightpane += seq2[lastmatch[1] + line]
 
-        charobj   = difflib.SequenceMatcher(None, leftpane, rightpane)
+        charobj = difflib.SequenceMatcher(None, leftpane, rightpane)
         charmatch = charobj.get_matching_blocks()
 
         if charobj.ratio() < 0.5:
@@ -108,7 +108,7 @@
             # Some similarities; markup changes.
             charlast = (0, 0)
 
-            leftresult  = ''
+            leftresult = ''
             rightresult = ''
             for thismatch in charmatch:
                 if thismatch[0] - charlast[0] != 0:
@@ -121,7 +121,7 @@
                 rightresult += escape(rightpane[thismatch[1]:thismatch[1] + thismatch[2]])
                 charlast = (thismatch[0] + thismatch[2], thismatch[1] + thismatch[2])
 
-        leftpane  = '<br>\n'.join(map(indent, leftresult.splitlines()))
+        leftpane = '<br>\n'.join(map(indent, leftresult.splitlines()))
         rightpane = '<br>\n'.join(map(indent, rightresult.splitlines()))
 
         # removed width="50%%"
--- a/MoinMoin/util/diff3.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/diff3.py	Sat Jul 22 13:43:06 2006 +0200
@@ -25,7 +25,7 @@
     old_nr, other_nr, new_nr = 0, 0, 0
     old_len, other_len, new_len = len(old), len(other), len(new)
     result = []
-    while old_nr < old_len and other_nr < other_len  and new_nr < new_len:
+    while old_nr < old_len and other_nr < other_len and new_nr < new_len:
         # unchanged
         if old[old_nr] == other[other_nr] == new[new_nr]:
             result.append(old[old_nr])
@@ -82,7 +82,7 @@
 
     # process tail
     # all finished
-    if old_nr == old_len and other_nr == other_len  and new_nr == new_len:
+    if old_nr == old_len and other_nr == other_len and new_nr == new_len:
         pass
     # new added lines
     elif old_nr == old_len and other_nr == other_len:
@@ -122,9 +122,9 @@
             if match_len == difference:
                 return (new_match[0], other_match[1]+difference, new_match[1])
             else:
-                other_match =  find_match(old, other,
-                                          other_match[0] + match_len,
-                                          other_match[1] + match_len)
+                other_match = find_match(old, other,
+                                         other_match[0] + match_len,
+                                         other_match[1] + match_len)
         # other changed more lines
         elif difference < 0:
             difference = -difference
@@ -134,14 +134,14 @@
                 return (other_match[0], other_match[1],
                         new_match[0] + difference)
             else:
-                new_match =  find_match(old, new,
-                                        new_match[0] + match_len,
-                                        new_match[1] + match_len)
+                new_match = find_match(old, new,
+                                       new_match[0] + match_len,
+                                       new_match[1] + match_len)
         # both conflicts change same number of lines
         # or no match till the end
         else:
             return (new_match[0], other_match[1], new_match[1])
-        
+
 def match(list1, list2, nr1, nr2, maxcount=3):
     """ return the number matching items after the given positions
         maximum maxcount lines are are processed 
@@ -176,10 +176,10 @@
                 hit1 = (i, idx2)
                 break
             i += 1
-            
+
         i = nr2
         while i < idx2:
-            hit_count = match(list1, list2, idx1, i, mincount) 
+            hit_count = match(list1, list2, idx1, i, mincount)
             if hit_count >= mincount:
                 hit2 = (idx1, i)
                 break
--- a/MoinMoin/util/filesys.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/filesys.py	Sat Jul 22 13:43:06 2006 +0200
@@ -109,7 +109,7 @@
     """
     names = os.listdir(src)
     os.mkdir(dst)
-    copystat(src,dst)
+    copystat(src, dst)
     errors = []
     for name in names:
         srcname = os.path.join(src, name)
@@ -167,3 +167,4 @@
 
     def realPathCase(path):
         return None
+
--- a/MoinMoin/util/lock.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/lock.py	Sat Jul 22 13:43:06 2006 +0200
@@ -23,7 +23,7 @@
     """
     defaultSleep = 0.25
     maxSleep = 0.25
-    
+
     def __init__(self, timeout):
         self.setTimeout(timeout)
         self._start = None
@@ -35,7 +35,7 @@
             self._sleep = self.defaultSleep
         else:
             self._sleep = min(timeout / 10.0, self.maxSleep)
-        
+
     def start(self):
         """ Start the countdown """
         if self.timeout is None:
@@ -53,7 +53,7 @@
     def sleep(self):
         """ Sleep without sleeping over timeout """
         if self._stop is not None:
-            timeLeft = max(self._stop - time.time(), 0)            
+            timeLeft = max(self._stop - time.time(), 0)
             sleep = min(self._sleep, timeLeft)
         else:
             sleep = self._sleep
@@ -62,7 +62,7 @@
     def elapsed(self):
         return time.time() - self._start
 
-    
+
 class ExclusiveLock:
     """ Exclusive lock
     
@@ -77,7 +77,7 @@
     """
     fileName = '' # The directory is the lockDir
     timerClass = Timer
-    
+
     def __init__(self, dir, timeout=None):
         """ Init a write lock
         
@@ -96,7 +96,7 @@
             self.lockDir = os.path.join(dir, self.fileName)
             self._makeDir()
         else:
-            self.lockDir = dir            
+            self.lockDir = dir
         self._locked = False
 
     def acquire(self, timeout=None):
@@ -165,7 +165,7 @@
         return False
 
     # Private -------------------------------------------------------
-    
+
     def _makeDir(self):
         """ Make sure directory exists """
         try:
@@ -180,7 +180,7 @@
         try:
             os.rmdir(self.lockDir)
         except OSError, err:
-            if err.errno != errno.ENOENT: 
+            if err.errno != errno.ENOENT:
                 raise
 
 
@@ -195,7 +195,7 @@
     lock will try to expire all existing ReadLocks.
     """
     fileName = 'write_lock'
-    
+
     def __init__(self, dir, timeout=None, readlocktimeout=None):
         """ Init a write lock
         
@@ -211,7 +211,7 @@
             self.readlocktimeout = timeout
         else:
             self.readlocktimeout = readlocktimeout
-    
+
     def acquire(self, timeout=None):
         """ Acquire an exclusive write lock
         
@@ -221,7 +221,7 @@
         acquired.
         
         Return True if lock acquired, False otherwise.
-        """        
+        """
         if self._locked:
             raise RuntimeError("lock already locked")
         result = False
@@ -242,9 +242,9 @@
                 else:
                     self.release()
         return False
-        
+
     # Private -------------------------------------------------------
-    
+
     def _expireReadLocks(self):
         """ Expire old read locks """
         readLockFileName = ReadLock.fileName
@@ -255,7 +255,7 @@
             ExclusiveLock(LockDir, self.readlocktimeout).expire()
 
     def _haveReadLocks(self):
-        """ Return True if read locks exists; False otherwise """            
+        """ Return True if read locks exists; False otherwise """
         readLockFileName = ReadLock.fileName
         for name in os.listdir(self.dir):
             if name.startswith(readLockFileName):
@@ -273,7 +273,7 @@
     Allows only one lock per instance.
     """
     fileName = 'read_lock_'
-            
+
     def __init__(self, dir, timeout=None):
         """ Init a read lock
         
@@ -302,6 +302,6 @@
                 # log('acquired read lock: %s\n' % self.lockDir)
                 return True
             finally:
-                self.writeLock.release()       
+                self.writeLock.release()
         return False
 
--- a/MoinMoin/util/profile.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/profile.py	Sat Jul 22 13:43:06 2006 +0200
@@ -64,7 +64,7 @@
         self.count = 0 # count between somples
         self.requests = 0 # requests added
         self.data = {'collect': 'NA'} # Sample data
-        
+
     def addRequest(self):
         """ Add a request to the profile
 
@@ -76,12 +76,12 @@
         Invoke sample when self.count reach self.requestsPerSample.
         """
         self.requests += 1
-        self.count += 1 
+        self.count += 1
         if self.count == self.requestsPerSample:
             # Time for a sample
             self.count = 0
             self.sample()
-    
+
     def sample(self):
         """ Make a sample of memory usage and log it
 
@@ -90,13 +90,13 @@
         
         Invoke common methods for all profilers. Some profilers like
         TwistedProfiler override this method. 
-        """        
+        """
         self._setData()
         self._setMemory()
         self._log()
-    
+
     # Private methods ------------------------------------------------------
-    
+
     def _setData(self):
         """ Collect sample data into self.data
 
@@ -109,7 +109,7 @@
             d['collect'] = str(gc.collect())
         d['objects'] = len(gc.get_objects())
         d['garbage'] = len(gc.garbage)
-                     
+
     def _setMemory(self):
         """ Get process memory usage
 
@@ -120,14 +120,14 @@
         """
         lines = os.popen('/bin/ps -p %s -o rss' % self.pid).readlines()
         self.data['memory'] = lines[1].strip()
-    
+
     def _log(self):
         """ Format sample and write to log
 
         Private method used by profilers.
         """
         line = ('%(date)s req:%(requests)d mem:%(memory)sKB collect:%(collect)s '
-                'objects:%(objects)d garbage:%(garbage)d\n' % self.data) 
+                'objects:%(objects)d garbage:%(garbage)d\n' % self.data)
         self.logfile.write(line)
         self.logfile.flush()
 
@@ -145,10 +145,10 @@
         Invoke Profiler.__init__ and import getProcessOuput from
         twisted.
         """
-        Profiler.__init__(self, name, requestsPerSample, collect) 
+        Profiler.__init__(self, name, requestsPerSample, collect)
         from twisted.internet.utils import getProcessOutput
-        self._getProcessOutput = getProcessOutput        
-        
+        self._getProcessOutput = getProcessOutput
+
     def sample(self):
         """ Make a sample of memory usage and log it
         
@@ -161,23 +161,22 @@
         """
         self._setData()
         # Memory will be available little later
-        deferred = self._getProcessOutput('/bin/ps', 
+        deferred = self._getProcessOutput('/bin/ps',
                                           ('-p', str(self.pid), '-o', 'rss'))
         deferred.addCallback(self._callback)
 
     # Private methods ------------------------------------------------------
-    
-    def _callback(self, data):        
+
+    def _callback(self, data):
         """ Called from deferred when ps output is available
 
         Private method, don't call this.
         """
         self.data['memory'] = data.split('\n')[1].strip()
-        self._log()  
-    
-    
+        self._log()
+
+
 if __name__ == '__main__':
     # In case someone try to run as a script
     print __doc__
-    
 
--- a/MoinMoin/util/pysupport.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/pysupport.py	Sat Jul 22 13:43:06 2006 +0200
@@ -30,7 +30,7 @@
     import os, re
 
     packagedir = os.path.dirname(packagefile)
-    
+
     in_plugin_dir = lambda dir, ops=os.path.split: ops(ops(dir)[0])[1] == "plugin"
 
     moinmodule = __import__('MoinMoin')
@@ -85,12 +85,12 @@
     if lock is None:
         import threading
         lock = threading.Lock()
-    
+
     def decorated(*args, **kw):
         lock.acquire()
         try:
             return function(*args, **kw)
         finally:
             lock.release()
-            
+
     return decorated
--- a/MoinMoin/util/thread_monitor.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/util/thread_monitor.py	Sat Jul 22 13:43:06 2006 +0200
@@ -41,7 +41,7 @@
 
 def dump_hook(a, b, c): # arguments are ignored
     global dumping
-    
+
     if dumping and sys.exc_info()[0] is None:
         thread = threading.currentThread()
         if thread in to_dump:
@@ -65,7 +65,7 @@
     """ Activates the thread monitor hook. Note that this interferes
     with any kind of profiler and some debugging extensions. """
     global hook_enabled
-    
+
     sys.setprofile(dump_hook)
     threading.setprofile(dump_hook)
     hook_enabled = True
@@ -78,6 +78,6 @@
         while 1:
             sleep(seconds)
             trigger_dump()
-    
+
     threading.Thread(target=background_dumper, args=(seconds, )).start()
 
--- a/MoinMoin/widget/base.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/widget/base.py	Sat Jul 22 13:43:06 2006 +0200
@@ -12,5 +12,5 @@
         self.request = request
 
     def render(self):
-        raise NotImplementedError 
+        raise NotImplementedError
 
--- a/MoinMoin/widget/html.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/widget/html.py	Sat Jul 22 13:43:06 2006 +0200
@@ -26,7 +26,7 @@
     def __unicode__(self):
         return wikiutil.escape(self.text)
 
-        
+
 class Raw:
     """ Raw HTML code.
     """
@@ -36,7 +36,7 @@
     def __unicode__(self):
         return self.markup
 
-        
+
 class Element:
     """ Abstract base class for HTML elements.
     """
@@ -86,9 +86,9 @@
         return ' '.join(result)
 
     def __unicode__(self):
-        raise NotImplementedError 
+        raise NotImplementedError
 
-        
+
 class EmptyElement(Element):
     """ HTML elements with an empty content model.
     """
--- a/MoinMoin/wikixml/marshal.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/wikixml/marshal.py	Sat Jul 22 13:43:06 2006 +0200
@@ -34,7 +34,7 @@
     # Container Tags
     ROOT_CONTAINER = "data"
     ITEM_CONTAINER = "item"
-    
+
     # List of private prefixes
     PRIVATE_PREFIXES = ['_']
 
@@ -42,7 +42,7 @@
     TAG_MAP = {}
 
 
-    def __toXML(self, element, data): 
+    def __toXML(self, element, data):
         """ Recursive helper method that transforms an object to XML.
         
             Returns a list of strings, which constitute the XML document.
--- a/MoinMoin/xmlrpc/ProcessMail.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/xmlrpc/ProcessMail.py	Sat Jul 22 13:43:06 2006 +0200
@@ -12,13 +12,13 @@
     request = xmlrpcobj.request
     secret = xmlrpcobj._instr(secret)
     mail = str(mail)
-    
+
     if not request.cfg.mail_import_secret:
         return u"No password set"
-    
+
     if request.cfg.mail_import_secret != secret:
         return u"Invalid password"
-    
+
     try:
         mailimport.import_mail_from_string(request, mail)
     except mailimport.ProcessingError, e:
--- a/MoinMoin/xmlrpc/UpdateGroup.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/xmlrpc/UpdateGroup.py	Sat Jul 22 13:43:06 2006 +0200
@@ -34,7 +34,7 @@
     # change your wikiconfig to have xmlrpc_putpage_trusted_only = 0
     # and make very very sure that nobody untrusted can access your wiki
     # via network or somebody will raid your wiki some day!
-        
+
     if self.request.cfg.xmlrpc_putpage_trusted_only and not self.request.user.trusted:
         return xmlrpclib.Fault(1, "You are not allowed to edit this page")
 
@@ -45,7 +45,7 @@
     # check if groupname matches page_group_regex
     if not re.match(self.request.cfg.page_group_regex, groupname):
         return xmlrpclib.Fault(2, "The groupname %s does not match your page_group_regex (%s)" % (
-	                          groupname, self.request.cfg.page_group_regex))
+                               groupname, self.request.cfg.page_group_regex))
 
     newtext = """\
 #acl %(acl)s
@@ -56,7 +56,7 @@
     'comment': groupcomment,
     'memberlist': "\n * ".join([''] + memberlist)
     }
-    
+
     page = PageEditor(self.request, pagename)
     try:
         msg = page.saveText(newtext, 0)
--- a/MoinMoin/xmlrpc/__init__.py	Sat Jul 22 13:21:36 2006 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Sat Jul 22 13:43:06 2006 +0200
@@ -59,7 +59,7 @@
         @return: string in config.charset
         """
         raise "NotImplementedError"
-    
+
     def _outstr(self, text):
         """ Convert outbound string to utf-8.
 
@@ -68,7 +68,7 @@
         @return: string in utf-8
         """
         raise "NotImplementedError"
-    
+
     def _inlob(self, text):
         """ Convert inbound base64-encoded utf-8 to Large OBject.
         
@@ -93,7 +93,7 @@
             if config.charset != 'utf-8':
                 text = unicode(text, config.charset).encode('utf-8')
         return xmlrpclib.Binary(text)
-                    
+
     def _dump_exc(self):
         """ Convert an exception to a string.
         
@@ -113,13 +113,13 @@
         try:
             data = self.request.read()
             params, method = xmlrpclib.loads(data)
-    
+
             if _debug:
                 sys.stderr.write('- XMLRPC ' + '-' * 70 + '\n')
                 sys.stderr.write('%s(%s)\n\n' % (method, repr(params)))
-            
+
             response = self.dispatch(method, params)
-            
+
         except:
             # report exception back to server
             response = xmlrpclib.dumps(xmlrpclib.Fault(1, self._dump_exc()))
@@ -142,7 +142,7 @@
 
     def dispatch(self, method, params):
         method = method.replace(".", "_")
-        
+
         try:
             fn = getattr(self, 'xmlrpc_' + method)
         except AttributeError:
@@ -156,16 +156,16 @@
                 response = fn(self, *params)
         else:
             response = fn(*params)
-        
+
         return response
 
     # Common faults -----------------------------------------------------
-    
+
     def notAllowedFault(self):
         return xmlrpclib.Fault(1, "You are not allowed to read this page.")
 
     def noSuchPageFault(self):
-        return xmlrpclib.Fault(1, "No such page was found.")        
+        return xmlrpclib.Fault(1, "No such page was found.")
 
     #############################################################################
     ### System methods
@@ -193,13 +193,13 @@
                 results.append([self.dispatch(method_name, params)])
             except xmlrpclib.Fault, fault:
                 results.append(
-                    {'faultCode' : fault.faultCode,
-                     'faultString' : fault.faultString}
+                    {'faultCode': fault.faultCode,
+                     'faultString': fault.faultString}
                     )
             except:
                 results.append(
-                    {'faultCode' : 1,
-                     'faultString' : "%s:%s" % (sys.exc_type, sys.exc_value)}
+                    {'faultCode': 1,
+                     'faultString': "%s:%s" % (sys.exc_type, sys.exc_value)}
                     )
         return results
 
@@ -240,9 +240,9 @@
             * version (int) :
                 Current version.
         """
-        
+
         return_items = []
-        
+
         edit_log = editlog.EditLog(self.request)
         for log in edit_log.reverse():
             # get last-modified UTC (DateTime) from log
@@ -252,11 +252,11 @@
             # skip if older than "date"
             if lastModified_date < date:
                 break
-            
+
             # skip if knowledge not permitted
             if not self.request.user.may.read(log.pagename):
                 continue
-            
+
             # get page name (str) from log
             pagename_str = self._outstr(log.pagename)
 
@@ -268,12 +268,12 @@
                     author_str = userdata.name
             author_str = self._outstr(author_str)
 
-            return_item = { 'name':  pagename_str,
-                            'lastModified': lastModified_date,
-                            'author': author_str,
-                            'version': int(log.rev) }
+            return_item = {'name': pagename_str,
+                           'lastModified': lastModified_date,
+                           'author': author_str,
+                           'version': int(log.rev) }
             return_items.append(return_item)
-        
+
         return return_items
 
     def xmlrpc_getPageInfo(self, pagename):
@@ -299,7 +299,7 @@
         if not self.request.user.may.read(pn):
             return self.notAllowedFault()
 
-        if rev != None:
+        if rev is not None:
             page = Page(self.request, pn, rev=rev)
         else:
             page = Page(self.request, pn)
@@ -310,10 +310,10 @@
             return self.noSuchPageFault()
 
         # Get page info
-        last_edit = page.last_edit(self.request)           
+        last_edit = page.last_edit(self.request)
         mtime = wikiutil.version2timestamp(long(last_edit['timestamp'])) # must be long for py 2.2.x
         gmtuple = tuple(time.gmtime(mtime))
-        
+
         version = rev # our new rev numbers: 1,2,3,4,....
 
         #######################################################################
@@ -326,10 +326,10 @@
         if self.request.cfg.sitename == 'MoinMaster' and pagename == 'BadContent':
             version = int(mtime)
         #######################################################################
-            
+
         return {
             'name': self._outstr(page.page_name),
-            'lastModified' : xmlrpclib.DateTime(gmtuple),
+            'lastModified': xmlrpclib.DateTime(gmtuple),
             'author': self._outstr(last_edit['editor']),
             'version': version,
             }
@@ -345,14 +345,14 @@
         @param rev: revision number (int)
         @rtype: str
         @return: utf-8 encoded page data
-        """    
+        """
         pagename = self._instr(pagename)
 
         # User may read page?
         if not self.request.user.may.read(pagename):
             return self.notAllowedFault()
 
-        if rev != None:
+        if rev is not None:
             page = Page(self.request, pagename, rev=rev)
         else:
             page = Page(self.request, pagename)
@@ -385,7 +385,7 @@
         if not self.request.user.may.read(pagename):
             return self.notAllowedFault()
 
-        if rev != None:
+        if rev is not None:
             page = Page(self.request, pagename, rev=rev)
         else:
             page = Page(self.request, pagename)
@@ -393,11 +393,11 @@
         # Non existing page?
         if not page.exists():
             return self.noSuchPageFault()
-        
+
         # Render page into a buffer
         result = self.request.redirectedOutput(page.send_page, self.request,
                                                content_only=1)
-        
+
         # Return rendered page
         if self.version == 2:
             return self._outstr(result)
@@ -425,10 +425,10 @@
         # Non existing page?
         if not page.exists():
             return self.noSuchPageFault()
-        
+
         links_out = []
         for link in page.getPageLinks(self.request):
-            links_out.append({ 'name': self._outstr(link), 'type': 0 })
+            links_out.append({'name': self._outstr(link), 'type': 0 })
         return links_out
 
     def xmlrpc_putPage(self, pagename, pagetext):
@@ -440,10 +440,10 @@
         @return: true on success
         """
         # READ THIS OR IT WILL NOT WORK ===================================
-        
+
         # we use a test page instead of using the requested pagename, if
         # xmlrpc_putpage_enabled was not set in wikiconfig.
-        
+
         if self.request.cfg.xmlrpc_putpage_enabled:
             pagename = self._instr(pagename)
         else:
@@ -455,7 +455,7 @@
         # change your wikiconfig to have xmlrpc_putpage_trusted_only = 0
         # and make very very sure that nobody untrusted can access your wiki
         # via network or somebody will raid your wiki some day!
-        
+
         if self.request.cfg.xmlrpc_putpage_trusted_only and not self.request.user.trusted:
             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
 
@@ -499,7 +499,7 @@
         return (version.project, version.release, version.revision)
 
     # authorization methods
-    
+
     def xmlrpc_getAuthToken(self, username, password, *args):
         """ Returns a token which can be used for authentication
             in other XMLRPC calls. If the token is empty, the username
@@ -509,7 +509,7 @@
             return u.id
         else:
             return ""
-    
+
     def xmlrpc_applyAuthToken(self, auth_token):
         """ Applies the auth token and thereby authenticates the user. """
         u = user.User(self.request, id=auth_token, auth_method='xmlrpc_applytoken')
@@ -518,11 +518,11 @@
             return "SUCCESS"
         else:
             return xmlrpclib.Fault("INVALID", "Invalid token.")
-    
+
     def xmlrpc_getDiff(self, pagename, from_rev, to_rev):
         """ Gets the binary difference between two page revisions. See MoinMoin:WikiSyncronisation. """
         from MoinMoin.util.bdiff import textdiff, compress
-        
+
         pagename = self._instr(pagename)
 
         # User may read page?
@@ -536,44 +536,44 @@
 
         if not allowed_rev_type(from_rev):
             return xmlrpclib.Fault("FROMREV_INVALID", "Incorrect type for from_rev.")
-        
+
         if not allowed_rev_type(to_rev):
             return xmlrpclib.Fault("TOREV_INVALID", "Incorrect type for to_rev.")
-        
+
         currentpage = Page(self.request, pagename)
         if not currentpage.exists():
             return xmlrpclib.Fault("NOT_EXIST", "Page does not exist.")
-        
+
         revisions = currentpage.getRevList()
-        
+
         if from_rev is not None and from_rev not in revisions:
             return xmlrpclib.Fault("FROMREV_INVALID", "Unknown from_rev.")
         if to_rev is not None and to_rev not in revisions:
             return xmlrpclib.Fault("TOREV_INVALID", "Unknown to_rev.")
-        
+
         # use lambda to defer execution in the next lines
         if from_rev is None:
             oldcontents = lambda: ""
         else:
             oldpage = Page(request, pagename, rev=from_rev)
             oldcontents = lambda: oldpage.get_raw_body_str()
-        
+
         if to_rev is None:
             newcontents = lambda: currentpage.get_raw_body()
         else:
             newpage = Page(request, pagename, rev=to_rev)
             newcontents = lambda: newpage.get_raw_body_str()
             newrev = newpage.get_real_rev()
-        
+
         if oldcontents() and oldpage.get_real_rev() == newpage.get_real_rev():
             return xmlrpclib.Fault("ALREADY_CURRENT", "There are no changes.")
-        
+
         newcontents = newcontents()
         conflict = wikiutil.containsConflictMarker(newcontents)
         diffblob = xmlrpclib.Binary(compress(textdiff(oldcontents(), newcontents)))
-        
+
         return {"conflict": conflict, "diff": diffblob, "diffversion": 1, "current": currentpage.get_real_rev()}
-    
+
     def xmlrpc_interwikiName(self):
         """ Returns the interwiki name of the current wiki. """
         name = self.request.cfg.interwikiname
@@ -581,7 +581,7 @@
             return None
         else:
             return self._outstr(name)
-    
+
     def xmlrpc_mergeChanges(self, pagename, diff, local_rev, delta_remote_rev, last_remote_rev, interwiki_name):
         """ Merges a diff sent by the remote machine and returns the number of the new revision.
             Additionally, this method tags the new revision.
@@ -594,38 +594,38 @@
             @param interwiki_name: Used to build the interwiki tag.
         """
         from MoinMoin.util.bdiff import decompress, patch
-        
+
         pagename = self._instr(pagename)
-       
+
         # User may read page?
         if not self.request.user.may.read(pagename) or not self.request.user.may.write(pagename):
             return self.notAllowedFault()
 
         # XXX add locking here!
-        
+
         # current version of the page
         currentpage = Page(self.request, pagename)
 
         if currentpage.get_real_rev() != last_remote_rev:
             return xmlrpclib.Fault("LASTREV_INVALID", "The page was changed")
-        
+
         if not currentpage.exists() and diff is None:
             return xmlrpclib.Fault("NOT_EXIST", "The page does not exist and no diff was supplied.")
-        
+
         # base revision used for the diff
         basepage = Page(self.request, pagename, rev=delta_remote_rev)
-        
+
         # generate the new page revision by applying the diff
         newcontents = patch(basepage.get_raw_body_str(), decompress(str(diff)))
-        
+
         # write page
         # XXX ...
-        
+
         # XXX add a tag (interwiki_name, local_rev, current rev) to the page
         # XXX return current rev
         # XXX finished
-        
-        
+
+
     # XXX BEGIN WARNING XXX
     # All xmlrpc_*Attachment* functions have to be considered as UNSTABLE API -
     # they are neither standard nor are they what we need when we have switched
@@ -641,12 +641,12 @@
         @param pagename: pagename (utf-8)
         @rtype: list
         @return: a list of utf-8 attachment names
-        """    
+        """
         pagename = self._instr(pagename)
         # User may read page?
         if not self.request.user.may.read(pagename):
             return self.notAllowedFault()
-        
+
         result = AttachFile._get_files(self.request, pagename)
         return result
 
@@ -690,7 +690,7 @@
         # also check ACLs
         if not self.request.user.may.write(pagename):
             return xmlrpclib.Fault(1, "You are not allowed to edit this page")
-        
+
         attachname = wikiutil.taintfilename(attachname)
         filename = AttachFile.getFilename(self.request, pagename, attachname)
         if os.path.exists(filename) and not os.path.isfile(filename):
@@ -699,12 +699,12 @@
         os.chmod(filename, 0666 & config.umask)
         AttachFile._addLogEntry(self.request, 'ATTNEW', pagename, filename)
         return xmlrpclib.Boolean(1)
-    
+
     # XXX END WARNING XXX
 
 
 class XmlRpc1(XmlRpcBase):
-    
+
     def __init__(self, request):
         XmlRpcBase.__init__(self, request)
         self.version = 1
@@ -727,9 +727,9 @@
         """
         return wikiutil.url_quote(text) # config.charset must be utf-8
 
-    
+
 class XmlRpc2(XmlRpcBase):
-    
+
     def __init__(self, request):
         XmlRpcBase.__init__(self, request)
         self.version = 2
@@ -753,9 +753,9 @@
         @return: text encoded in utf-8
         """
         if isinstance(text, unicode):
-            text = text.encode('utf-8')           
-        elif config.charset != 'utf-8':        
-            text = unicode(text, config.charset).encode('utf-8')               
+            text = text.encode('utf-8')
+        elif config.charset != 'utf-8':
+            text = unicode(text, config.charset).encode('utf-8')
         return text