[Mpuls-commits] r5448 - in base/trunk/mpulsweb: controllers lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Oct 11 14:00:24 CEST 2011


Author: ludwig
Date: 2011-10-11 14:00:23 +0200 (Tue, 11 Oct 2011)
New Revision: 5448

Modified:
   base/trunk/mpulsweb/controllers/formularpage.py
   base/trunk/mpulsweb/lib/navigation.py
Log:
Issue 956 Use a method parent_repeat instead of direct parent.repeat.


Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2011-10-11 11:41:49 UTC (rev 5447)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2011-10-11 12:00:23 UTC (rev 5448)
@@ -169,7 +169,7 @@
             pass
         session['uncommited_fields'] = instance_tree.commit()
         
-        if session['navigation.tree'].getTreeItem(page_id).parent.repeat:
+        if session['navigation.tree'].getTreeItem(page_id).parent_repeat():
             session['navigation.tree'] = get_navigation(
                                          case_id,
                                          session['navigation.openfolders'])
@@ -180,13 +180,12 @@
 
         if request.params.has_key('savenext'):
             ti = session['navigation.tree'].getTreeItem(page_id)
-            if ti.parent.repeat:
+            if ti.parent_repeat():
                 page_id = ti.parent.key
+            elif ti.nextKey().parent_repeat():
+                page_id = ti.nextKey().parent.key
             else:
-                if ti.nextKey().parent.repeat:
-                    page_id = ti.nextKey().parent.key
-                else:
-                    page_id = ti.nextKey().key
+                page_id = ti.nextKey().key
 
         # Check consistence of case and retag
         self._check_case_validity(case_id)

Modified: base/trunk/mpulsweb/lib/navigation.py
===================================================================
--- base/trunk/mpulsweb/lib/navigation.py	2011-10-11 11:41:49 UTC (rev 5447)
+++ base/trunk/mpulsweb/lib/navigation.py	2011-10-11 12:00:23 UTC (rev 5448)
@@ -78,6 +78,9 @@
     navigation = NavigationTree(instance_tree, openfolders)
     return navigation
 
+def get_navigation_from_instance_tree(instance_tree, openfolders=None):
+    return NavigationTree(instance_tree, openfolders)
+
 def render_navigation(mode="r"):
     tree = session['navigation.tree']
     error_pages = set()
@@ -175,6 +178,12 @@
             cur = cur.parent
         return None
 
+    def parent_repeat(self):
+        if self.parent and self.parent.repeat:
+            return True
+        return False
+
+
     def unfold(self):
         opened = []
         cur = self
@@ -223,7 +232,7 @@
                                       % (_('entry'), _('Open page'))))
         icon.append('</a>')
         label = self.description
-        if self.parent.repeat:
+        if self.parent_repeat():
             label += " %s" % (num+1)
         entry.append(u'<a href="%s" %s>%s</a>'
                      % (select_link, CHECK_MODIFICATION,



More information about the Mpuls-commits mailing list