[Mpuls-commits] r258 - in wasko/trunk: . waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 11 20:02:43 CET 2009


Author: teichmann
Date: 2009-02-11 20:02:40 +0100 (Wed, 11 Feb 2009)
New Revision: 258

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/model/datapage.py
   wasko/trunk/waskaweb/model/navigation.py
Log:
Make DB access more tolerant.


Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-11 18:18:22 UTC (rev 257)
+++ wasko/trunk/ChangeLog.txt	2009-02-11 19:02:40 UTC (rev 258)
@@ -1,5 +1,12 @@
 2009-02-11	Sascha L. Teichmann	<teichmann at intevation.de>
 
+	* waskaweb/model/navigation.py: removed needless prints
+
+	* waskaweb/model/datapage.py: replaced '-' by '_' in
+	  relation names.
+
+2009-02-11	Sascha L. Teichmann	<teichmann at intevation.de>
+
 	Initial rebuild of the navigation.
 
 	* waskaweb/model/navigation.py: Build navigation tree from

Modified: wasko/trunk/waskaweb/model/datapage.py
===================================================================
--- wasko/trunk/waskaweb/model/datapage.py	2009-02-11 18:18:22 UTC (rev 257)
+++ wasko/trunk/waskaweb/model/datapage.py	2009-02-11 19:02:40 UTC (rev 258)
@@ -105,8 +105,10 @@
 
         fields['id'] = int(self.id)
 
+        rel = self.relation.replace('-', '_')
+
         stmnt = "UPDATE %s SET %s WHERE id = %%(id)s;" % (
-            self.relation, ", ".join(keys))
+            rel, ", ".join(keys))
 
         try:
             con, cur = None, None
@@ -137,7 +139,9 @@
             fields = ", ".join(self.items)
         except:
             pass
-        stmnt = "SELECT %s FROM %s WHERE id = %%(id)s;" % (fields, self.relation)
+        rel = self.relation.replace('-', '_')
+        stmnt = "SELECT %s FROM %s WHERE id = %%(id)s;" % (
+            fields, rel)
         try:
             con, cur = None, None
             try:

Modified: wasko/trunk/waskaweb/model/navigation.py
===================================================================
--- wasko/trunk/waskaweb/model/navigation.py	2009-02-11 18:18:22 UTC (rev 257)
+++ wasko/trunk/waskaweb/model/navigation.py	2009-02-11 19:02:40 UTC (rev 258)
@@ -150,18 +150,23 @@
         self.root  = self.build(formed, None)
 
     def build(self, nc, parent):
-        print >> sys.stderr, "class %s" % repr(nc)
 
         if isinstance(nc, PageNode):
-            #self.pages.append(nc.getName())
-            ti = TreeItem(self.key, get_page(nc), nc.getDescription())
+            ti = TreeItem(
+                self.key, get_page(nc), nc.getDescription())
+
             ti.parent = parent
             self.key += 1
             return ti
 
         if isinstance(nc, Node):
             children = []
-            n = TreeItem(self.key, get_page(nc), nc.getDescription(), children)
+            n = TreeItem(
+                self.key, 
+                get_page(nc), 
+                nc.getDescription(), 
+                children)
+
             n.parent = parent
             self.key += 1
             for child in nc.children:
@@ -241,7 +246,6 @@
 
     def render(self, select_action, toggle_action, selected_key=None):
         out = ['<ul>']
-        print >> sys.stderr, repr(self.root)
         for child in self.root.children:
             child.render(select_action, toggle_action, out, (child.page in self.errors), selected_key)
         out.append('</ul>')



More information about the Mpuls-commits mailing list