[Mpuls-commits] r5619 - base/trunk/mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Nov 18 20:54:25 CET 2011


Author: bh
Date: 2011-11-18 20:54:18 +0100 (Fri, 18 Nov 2011)
New Revision: 5619

Modified:
   base/trunk/mpulsweb/lib/base.py
Log:
Add parameter uncommitted to BaseController._loadCase.
It's simply passed through to the loadById method of the case factory.

This change prepares for the extended access checks for the formularpage
controller which will be extended to load cases via the _loadCase method
and we want to avoid having to instantiate the instance tree too many
times.

This is part of the changes for mpuls/issue2367.


Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2011-11-18 19:50:41 UTC (rev 5618)
+++ base/trunk/mpulsweb/lib/base.py	2011-11-18 19:54:18 UTC (rev 5619)
@@ -114,9 +114,13 @@
         self.db = None
         self.page_cache = None
 
-    def _loadCase(self, id, read_only=False):
+    def _loadCase(self, id, uncommitted=None, read_only=False):
         """Load and return the case object for the case with the given id.
 
+        The parameter uncommitted, if given and not None, should be a
+        dictionary usable as the uncommitted parameter of the loadById
+        method of the case factory.
+
         If the parameter read_only is false (the default), the case must
         be editable by the current user as determined by the case's
         user_may_edit method. If the case is not editable in this sense,
@@ -132,7 +136,7 @@
         to deny an action that should have been allowed, than to allow
         an action that ought to have been denied.
         """
-        case = g.case_factory.loadById(id)
+        case = g.case_factory.loadById(id, uncommitted=uncommitted)
 
         user = session["USER_AUTHORIZED"]
         if not case.user_may_read(user):



More information about the Mpuls-commits mailing list