[Mpuls-commits] r2606 - in wasko/branches/2.0: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue May 4 11:53:15 CEST 2010


Author: bh
Date: 2010-05-04 11:53:14 +0200 (Tue, 04 May 2010)
New Revision: 2606

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/export.py
Log:
* mpulsweb/lib/export.py: Fix formatting.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-05-04 09:52:40 UTC (rev 2605)
+++ wasko/branches/2.0/ChangeLog	2010-05-04 09:53:14 UTC (rev 2606)
@@ -1,5 +1,9 @@
 2010-05-04  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/export.py: Fix formatting.
+
+2010-05-04  Bernhard Herzog  <bh at intevation.de>
+
 	* jmdweb/public/formed/formedtree.xml: Fix rule for birthdays so
 	that the field may be empty or unknown.
 

Modified: wasko/branches/2.0/mpulsweb/lib/export.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/export.py	2010-05-04 09:52:40 UTC (rev 2605)
+++ wasko/branches/2.0/mpulsweb/lib/export.py	2010-05-04 09:53:14 UTC (rev 2606)
@@ -7,9 +7,11 @@
 
 from formed.meta.data import PageNode, WidgetCollector, RepeatNode
 
-from mpulsweb.lib.base import g 
+from mpulsweb.lib.base import g
+
 log = logging.getLogger(__name__)
 
+
 class MyStringIO(StringIO):
 
     def close(self):
@@ -18,7 +20,9 @@
     def real_close(self):
         MyStringIO.close(self)
 
+
 class FakeStr(str):
+
     def __init__(self, buf):
         self.buf = buf
 
@@ -27,29 +31,31 @@
 
 pyExcelerator.CompoundDoc.file = fake_file
 
+
 def to_str(x):
     t = type(x)
     if t in (IntType, LongType):
         return x
     if t in StringTypes:
         x = unicode(str(x), "utf-8")
-        if len(x) > 32765: x = x[:32765]
+        if len(x) > 32765:
+            x = x[:32765]
         return x
     return str(x)
 
+
 class Sheet(object):
 
     def __init__(self, worksheet, column_names, rg=False, rgname=None):
-
         for idx, name in enumerate(column_names):
             worksheet.write(0, idx, name)
 
         self.worksheet = worksheet
-        self.names     = column_names
-        self.rg        = rg 
-        self.rgname    = rgname
-        self.row       = 1
-        self.column    = 0
+        self.names = column_names
+        self.rg = rg
+        self.rgname = rgname
+        self.row = 1
+        self.column = 0
 
     def next_row(self):
         self.row += 1
@@ -60,14 +66,15 @@
             self.worksheet.write(self.row, self.column, to_str(value))
         self.column += 1
 
+
 class Book:
 
     def __init__(self, tree, selection):
         self.tree = tree
         self.selection = selection
-        self.workbook  = pyExcelerator.Workbook()
-        self.collectors = {} 
-        self.sheets = {} 
+        self.workbook = pyExcelerator.Workbook()
+        self.collectors = {}
+        self.sheets = {}
         self.pages = g.formedTree.findAllByClass(PageNode)
 
         for p in self.pages:
@@ -80,14 +87,15 @@
             collector = WidgetCollector()
             p.visit(collector.visitor)
 
-            if p.getName() not in self.selection: continue
+            if p.getName() not in self.selection:
+                continue
 
             sheet = self.workbook.add_sheet(p.getDescription())
             names = [w.getName() for w in collector.widgets]
 
             #save
-            self.sheets[p.getName()] = Sheet(sheet,names,rg,rgname)
-            self.collectors[p.getName()] = collector 
+            self.sheets[p.getName()] = Sheet(sheet, names, rg, rgname)
+            self.collectors[p.getName()] = collector
 
     def fill(self):
         for name, sheet in self.sheets.iteritems():
@@ -114,9 +122,12 @@
     def write_xls(self, fname):
         self.workbook.save(fname)
 
+
 class Export:
+
     pass
 
+
 class XLSExport(Export):
 
     def __init__(self, tree, selection):
@@ -131,11 +142,12 @@
         finally:
             out.real_close()
 
+
 class CSVExport(Export):
 
     def __init__(self, tree, selection):
-        self.csv = "" 
+        self.csv = ""
 
     def export(self):
         return "Test CSV"
-        
+



More information about the Mpuls-commits mailing list