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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 21 15:26:52 CEST 2011


Author: ludwig
Date: 2011-10-21 15:26:51 +0200 (Fri, 21 Oct 2011)
New Revision: 5491

Modified:
   base/trunk/mpulsweb/controllers/case_bundle.py
Log:
Issue 2162: At evaluate the standin cases are filtered out.
In same application _isEditor() will be overwritten, because standins need
there to be used.


Modified: base/trunk/mpulsweb/controllers/case_bundle.py
===================================================================
--- base/trunk/mpulsweb/controllers/case_bundle.py	2011-10-21 13:24:23 UTC (rev 5490)
+++ base/trunk/mpulsweb/controllers/case_bundle.py	2011-10-21 13:26:51 UTC (rev 5491)
@@ -169,6 +169,8 @@
                 return self.formletter(letter_id)
 
             if action == 'evaluate':
+                case_bundle = self._funcFilterBundle(case_bundle,
+                                                     self._isEditor)
                 case_bundle = self._filterBundle(case_bundle, (1, 4, 5))
                 if case_bundle.isEmpty():
                     return self._empty_caselist()
@@ -220,6 +222,13 @@
         case_bundle = MpulsCaseBundle(filtered)
         return case_bundle
 
+    def _funcFilterBundle(self, case_bundle, func):
+        filtered = []
+        for case in case_bundle.getCases(None):
+            if func(case):
+                filtered.append(case.id)
+        return MpulsCaseBundle(filtered)
+
     def _build_casebundle(self, options):
         if options.get('all_cases') > 0:
             ids = options["all_ids"]
@@ -235,6 +244,10 @@
                 u" Please make sure that the cases are"
                 u"\nin a state from which you can execute the selected action.")
         return render('/casebundle/dialogs/error.mako')
+    
+    def _isEditor(self, case):
+        return session['USER_AUTHORIZED'].getLogin()  \
+               == case.getEditor().getLogin()
 
     #
     # ACTIONS



More information about the Mpuls-commits mailing list