Index: /main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py	(revision 10676)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py	(revision 10677)
@@ -18,5 +18,5 @@
 """General helper functions for Kofa.
 """
-import unicodecsv as csv # XXX: csv ops should move to dedicated module.
+import unicodecsv as csv  # XXX: csv ops should move to dedicated module.
 import datetime
 import imghdr
@@ -43,4 +43,5 @@
 BUFSIZE = 8 * 1024
 
+
 def remove_file_or_directory(filepath):
     """Remove a file or directory.
@@ -58,4 +59,5 @@
         os.unlink(filepath)
     return
+
 
 def copy_filesystem_tree(src, dst, overwrite=False, del_old=False):
@@ -86,5 +88,5 @@
     for item in os.listdir(src):
         if item.startswith('.'):
-            continue # We do not copy hidden stuff...
+            continue  # We do not copy hidden stuff...
         itemsrc = os.path.join(src, item)
         itemdst = os.path.join(dst, item)
@@ -151,4 +153,5 @@
     return html_code
 
+
 class FactoryBase(grok.GlobalUtility):
     """A factory for things.
@@ -226,5 +229,5 @@
 
     """
-    grok.baseclass() # Do not grok this class, do not register us.
+    grok.baseclass()  # Do not grok this class, do not register us.
     grok.implements(IFactory)
     # You can override any of the following attributes in derived
@@ -246,4 +249,5 @@
         # Required by IFactory
         return implementedBy(self.factory)
+
 
 def ReST2HTML_w_warnings(source_string):
@@ -324,5 +328,5 @@
     if warning_msgs:
         # Render again, this time with no warnings inline...
-        fulldoc =  publish_string(
+        fulldoc = publish_string(
         source_string, writer_name='html4css1',
         settings_overrides={
@@ -337,4 +341,5 @@
         result = result.decode('utf-8')
     return result, warning_msgs
+
 
 def ReST2HTML(source_string):
@@ -384,4 +389,5 @@
     return html
 
+
 def attrs_to_fields(cls, omit=[]):
     """Turn the attributes of a class into FieldProperty instances.
@@ -399,4 +405,5 @@
     return cls
 
+
 def get_current_principal():
     """Get the 'current' principal.
@@ -416,7 +423,8 @@
     except NoInteraction:
         return None
-    except IndexError: # No participations present
+    except IndexError:  # No participations present
         return None
     return principal
+
 
 def cmp_files(file_descr1, file_descr2):
@@ -435,4 +443,5 @@
             return True
 
+
 def string_from_bytes(number):
     """Turn a number into some textual representation.
@@ -455,9 +464,10 @@
     if number < 1024:
         return u'%s byte(s)' % (str(number),)
-    elif number < 1024**2:
+    elif number < 1024 ** 2:
         return u'%s KB' % (number / 1024,)
-    elif number < 1024**3:
-        return u'%.2f MB' % (number / 1024**2,)
-    return u'%.2f GB' % (number / 1024**3,)
+    elif number < 1024 ** 3:
+        return u'%.2f MB' % (number / 1024 ** 2,)
+    return u'%.2f GB' % (number / 1024 ** 3,)
+
 
 def file_size(file_like_obj):
@@ -480,6 +490,7 @@
     if hasattr(file_like_obj, 'fileno'):
         return os.fstat(file_like_obj.fileno())[6]
-    file_like_obj.seek(0, 2) # seek to last position in file
+    file_like_obj.seek(0, 2)  # seek to last position in file
     return file_like_obj.tell()
+
 
 def get_user_account(request):
@@ -490,4 +501,5 @@
     account = authenticator.getAccount(principal_id)
     return account
+
 
 def iface_names(iface, omit=[], exclude_attribs=True, exclude_methods=True):
@@ -531,4 +543,5 @@
     return result
 
+
 def get_sorted_preferred(tuples_iterable, preferred_list):
     """Get a list of tuples (<TITLE>,<TOKEN>) with values in
@@ -573,4 +586,5 @@
     return tuple(result)
 
+
 def now(tz=None):
     """Get current datetime in timezone of `tz`.
@@ -581,4 +595,5 @@
     """
     return to_timezone(datetime.datetime.utcnow(), tz=tz)
+
 
 def to_timezone(dt, tz=None):
@@ -600,4 +615,5 @@
         dt = pytz.utc.localize(dt)
     return tz.normalize(dt.tzinfo.normalize(dt).astimezone(tz))
+
 
 def get_fileformat(path, bytestream=None):
@@ -633,4 +649,5 @@
     return img_type
 
+
 def check_pdf(bytestream, file):
     """Tell whether a file or bytestream is a PDF file.
@@ -650,4 +667,5 @@
 if check_pdf not in imghdr.tests:
     imghdr.tests.append(check_pdf)
+
 
 def merge_csv_files(path1, path2):
@@ -685,5 +703,5 @@
     wp, tmp_path = tempfile.mkstemp()
     writer = csv.DictWriter(os.fdopen(wp, 'wb'), fieldnames)
-    writer.writerow(dict((x,x) for x in fieldnames)) # header
+    writer.writerow(dict((x, x) for x in fieldnames))  # header
     for row in reader1:
         writer.writerow(row)
@@ -691,4 +709,5 @@
         writer.writerow(row)
     return tmp_path
+
 
 def product(sequence, start=1):
@@ -703,4 +722,5 @@
         result *= item
     return result
+
 
 class NullHandler(logging.Handler):
