[Mpuls-commits] r303 - in wasko/trunk: . waskaweb/controllers waskaweb/lib waskaweb/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Feb 25 17:23:52 CET 2009
Author: teichmann
Date: 2009-02-25 17:23:45 +0100 (Wed, 25 Feb 2009)
New Revision: 303
Modified:
wasko/trunk/ChangeLog.txt
wasko/trunk/waskaweb/controllers/case.py
wasko/trunk/waskaweb/lib/helpers.py
wasko/trunk/waskaweb/model/datapage.py
wasko/trunk/waskaweb/model/navigation.py
Log:
Fixed printing a bit.
Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt 2009-02-25 15:19:30 UTC (rev 302)
+++ wasko/trunk/ChangeLog.txt 2009-02-25 16:23:45 UTC (rev 303)
@@ -1,5 +1,19 @@
2009-02-25 Sascha L. Teichmann <teichmann at intevation.de>
+ Fixed printing a bit.
+
+ * waskaweb/model/navigation.py: Exchanged getAllItems() with new code.
+
+ * waskaweb/model/datapage.py: Log tracebacks if SELECT execution failed.
+
+ * waskaweb/controllers/case.py: repaired call to _getRenderdFormElements().
+ Set None fake c.page_id for printing
+
+ * waskaweb/lib/helpers.py: Make header/error helpers more robust against
+ None references.
+
+2009-02-25 Sascha L. Teichmann <teichmann at intevation.de>
+
* waskaweb/model/phases_factory.py: Render number of missing
fields for phases in phase overview.
Modified: wasko/trunk/waskaweb/controllers/case.py
===================================================================
--- wasko/trunk/waskaweb/controllers/case.py 2009-02-25 15:19:30 UTC (rev 302)
+++ wasko/trunk/waskaweb/controllers/case.py 2009-02-25 16:23:45 UTC (rev 303)
@@ -286,11 +286,12 @@
# append pagebreak
formular.append('<span style="page-break-after:always"></span>')
for ti in self.getNavigation().getAllItems():
- content, navigation = self._getRenderdFormElements(ti, id, ro_mode=True, no_data=empty)
+ content, navigation, warnings = self._getRenderdFormElements(ti, id, ro_mode=True, no_data=empty)
formular.append("""<h1>%s</h1>""" % ti.description)
if not ti.children: #Only add leaves
formular.append(content)
c.formular = "<br>".join(formular)
+ c.page_id = None
page = render('/casemanagement/formular.mako')
return page
Modified: wasko/trunk/waskaweb/lib/helpers.py
===================================================================
--- wasko/trunk/waskaweb/lib/helpers.py 2009-02-25 15:19:30 UTC (rev 302)
+++ wasko/trunk/waskaweb/lib/helpers.py 2009-02-25 16:23:45 UTC (rev 303)
@@ -195,7 +195,7 @@
def getFormularHeaders(page_id):
- #if type(page_id) != IntType: return u""
+ if page_id is None: return u""
navigation = session.get('navigation.tree')
if not navigation: return u""
tree_item = navigation.getTreeItem(page_id)
@@ -218,7 +218,7 @@
pass
def getErrorsAndWarningsOnPage(page_id, warnings=None):
- #if type(page_id) != IntType: return u""
+ if page_id is None: return u""
case = session.get('case')
if not case: return ""
navigation = session.get('navigation.tree')
Modified: wasko/trunk/waskaweb/model/datapage.py
===================================================================
--- wasko/trunk/waskaweb/model/datapage.py 2009-02-25 15:19:30 UTC (rev 302)
+++ wasko/trunk/waskaweb/model/datapage.py 2009-02-25 16:23:45 UTC (rev 303)
@@ -159,9 +159,8 @@
zip(self.items, [[convert(item), False] for item in res]))
except StandardError, err:
- pass
- #traceback.print_exc(file=sys.stderr)
- #print >> sys.stderr, "DB error: %s" % str(err)
+ traceback.print_exc(file=sys.stderr)
+ print >> sys.stderr, "DB error: %s" % str(err)
def save(self, params, old_errors, document):
Modified: wasko/trunk/waskaweb/model/navigation.py
===================================================================
--- wasko/trunk/waskaweb/model/navigation.py 2009-02-25 15:19:30 UTC (rev 302)
+++ wasko/trunk/waskaweb/model/navigation.py 2009-02-25 16:23:45 UTC (rev 303)
@@ -196,6 +196,7 @@
def __init__(self, formed):
self.key = 0
self.prev = None
+ self.first = None
self.root = self.build(formed, None)
def build(self, nc, parent):
@@ -204,6 +205,8 @@
if nc.isInvisible():
return None
ti = TreeItem(nc.getName(), nc.getDescription(), parent = parent)
+ if not self.first:
+ self.first = ti
if self.prev:
self.prev.next = ti
self.prev = ti
@@ -234,17 +237,14 @@
def __init__(self, formed, case=None):
builder = NavigationTreeBuilder(formed.root.children[0])
- self.root = builder.root
+ self.root = builder.root
+ self.first_page = builder.first
- def getAllItems(self, node=None):
- '''Returns a serialized list of treeitems'''
- if not node: node = self.root
- items = []
- for c in node.children:
- items.append(c)
- if c.children:
- items.extend(self.getAllItems(c))
- return items
+ def getAllItems(self):
+ page = self.first_page
+ while page:
+ yield page
+ page = page.next
def getTreeItem(self, key):
key = int(key)
More information about the Mpuls-commits
mailing list