[Mpuls-commits] r5624 - base/trunk/mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 18 21:50:33 CET 2011


Author: bh
Date: 2011-11-18 21:49:32 +0100 (Fri, 18 Nov 2011)
New Revision: 5624

Modified:
   base/trunk/mpulsweb/controllers/formularpage.py
Log:
Add instance_tree parameter to get_rendered_page.
The new parameter can be used to pass an existing instance tree into
get_rendered_page so that it doesn't have to be loaded again. If the
instance_tree parameter is omitted or None, an instance_tree is loaded
like before.


Modified: base/trunk/mpulsweb/controllers/formularpage.py
===================================================================
--- base/trunk/mpulsweb/controllers/formularpage.py	2011-11-18 20:43:29 UTC (rev 5623)
+++ base/trunk/mpulsweb/controllers/formularpage.py	2011-11-18 20:49:32 UTC (rev 5624)
@@ -46,11 +46,12 @@
     return result
 
 
-def get_rendered_page(id):
-    factory = InstanceFactory(g.formedTree, PostgresDBInterface())
-    instance_tree = factory.loadInstanceTreeByIdentifier(
-        session['case'].id,
-        session.get('uncommited_fields'))
+def get_rendered_page(id, instance_tree=None):
+    if instance_tree is None:
+        factory = InstanceFactory(g.formedTree, PostgresDBInterface())
+        instance_tree = factory.loadInstanceTreeByIdentifier(
+            session['case'].id,
+            session.get('uncommited_fields'))
 
     log.debug('Getting page "%s"' % id)
     page = instance_tree.getItem(id)



More information about the Mpuls-commits mailing list