[Mpuls-commits] r1193 - wasko/branches/2.0/waskaweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Feb 3 09:00:23 CET 2010


Author: torsten
Date: 2010-02-03 09:00:22 +0100 (Wed, 03 Feb 2010)
New Revision: 1193

Modified:
   wasko/branches/2.0/waskaweb/controllers/case.py
Log:
* waskaweb/controllers/case.py (CaseController.init_case): New. Moved
into CaseController. Was load_case before.
* waskaweb/controllers/case.py (checkPrivacyStatement.validate): Do
not call load_case. Load case directly using CaseFactory and loadById.


Modified: wasko/branches/2.0/waskaweb/controllers/case.py
===================================================================
--- wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-03 07:53:49 UTC (rev 1192)
+++ wasko/branches/2.0/waskaweb/controllers/case.py	2010-02-03 08:00:22 UTC (rev 1193)
@@ -149,23 +149,6 @@
 Wollen Sie wirklich die Fallakte wiederherstellen? Die Fallakte ist
 danach wieder für die Nutzer bearbeitbar."""
 
-def load_case(id):
-    '''Return a case object'''
-    factory = CaseFactory()
-    case = factory.loadById(id)
-    # New session code
-    session_case = case.getSessionCase()
-    session['case'] = session_case
-
-    open_folders = []
-    navigation = get_navigation(id)
-    session['render_mode'] = 'ro'
-    session['navigation.tree'] = navigation
-    session['navigation.openfolders'] = open_folders
-    session.save()
-    return case
-
-
 def checkPrivacyStatement(context='select'):
     '''Decorator for the methods in the case controller'''
     def validate(func, self, *args, **kwargs):
@@ -192,7 +175,8 @@
                                     id=case_id, confirmed=1)
 
         try:
-            case = self_.loadCase(case_id)
+            factory = CaseFactory()
+            case = factory.loadById(case_id)
         except:
             return render('/tests/trace.mako')
             self.showError()
@@ -256,6 +240,21 @@
     def __before__(self):
         CasebaseController.__before__(self)
 
+    def init_case(self, id):
+        '''Return a case object'''
+        case = self._loadCase(id)
+        # New session code
+        session_case = case.getSessionCase()
+        session['case'] = session_case
+
+        open_folders = []
+        navigation = get_navigation(id)
+        session['render_mode'] = 'ro'
+        session['navigation.tree'] = navigation
+        session['navigation.openfolders'] = open_folders
+        session.save()
+        return case
+
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
     def index(self):
         redirect_to(controller="/case_overview")
@@ -268,7 +267,7 @@
     @checkRole(('admin_ka', 'cm_ka', 'pt_dlr'))
     def digest(self, id):
         id = self._checkInt(id)
-        case = self._loadCase(id)
+        case = self.init_case(id)
         c.case = case
         c.last_access = case.getState().getAccessTime()
         c.daysToMaxSavetime = case.getState().daysToMaxSavetime()



More information about the Mpuls-commits mailing list