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

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


Author: bh
Date: 2011-11-18 21:43:29 +0100 (Fri, 18 Nov 2011)
New Revision: 5623

Modified:
   base/trunk/mpulsweb/lib/base.py
Log:
Add new method BaseController._load_current_case.
The _load_current_case methods loads the session's current case as
determined by the session values for 'case' and 'uncommited_fields'.


Modified: base/trunk/mpulsweb/lib/base.py
===================================================================
--- base/trunk/mpulsweb/lib/base.py	2011-11-18 20:23:14 UTC (rev 5622)
+++ base/trunk/mpulsweb/lib/base.py	2011-11-18 20:43:29 UTC (rev 5623)
@@ -165,6 +165,21 @@
         session.save()
         return case
 
+    def _load_current_case(self, read_only=False):
+        """Load and return the case object for the session's current case.
+
+        The session's current case is the one stored in the session case
+        in session['case'].
+
+        The case is loaded with the _loadCase method. The parameter
+        read_only is simply passed through to _loadCase. See the
+        documentation of _loadCase for the semantics of read_only and
+        which exception might be raised.
+        """
+        return self._loadCase(session['case'].id,
+                              session.get('uncommited_fields'),
+                              read_only=read_only)
+
     def __before__(self, environ):
         mpuls_session_module = import_overridable_module("lib.session")
         environ['paste.registry'].register(session,



More information about the Mpuls-commits mailing list