[Mpuls-commits] r2212 - in wasko/branches/2.0: . mpulsweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 25 20:09:57 CET 2010


Author: bh
Date: 2010-03-25 20:09:54 +0100 (Thu, 25 Mar 2010)
New Revision: 2212

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/controllers/case_bundle.py
Log:
* mpulsweb/controllers/case_bundle.py: Fix formatting.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-03-25 19:08:02 UTC (rev 2211)
+++ wasko/branches/2.0/ChangeLog	2010-03-25 19:09:54 UTC (rev 2212)
@@ -1,5 +1,9 @@
 2010-03-25  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/case_bundle.py: Fix formatting.
+
+2010-03-25  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/case.py: Fix formatting.
 
 2010-03-25  Bernhard Herzog  <bh at intevation.de>

Modified: wasko/branches/2.0/mpulsweb/controllers/case_bundle.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/case_bundle.py	2010-03-25 19:08:02 UTC (rev 2211)
+++ wasko/branches/2.0/mpulsweb/controllers/case_bundle.py	2010-03-25 19:09:54 UTC (rev 2212)
@@ -11,11 +11,12 @@
 from mpulsweb.lib.validators import BundleActionForm, SetBundleEditorForm, \
     SetBundleStandinForm
 from mpulsweb.lib.helper.filters import NA
-from mpulsweb.model.user import UserGroupList, UserListObject, UserObject 
-from mpulsweb.model.case import MpulsCaseBundle, MpulsCaseOverview 
+from mpulsweb.model.user import UserGroupList, UserListObject, UserObject
+from mpulsweb.model.case import MpulsCaseBundle, MpulsCaseOverview
 from mpulsweb.model.phase import ConsistenceCheckException
-from mpulsweb.controllers.case_overview import parseSearchOptions 
+from mpulsweb.controllers.case_overview import parseSearchOptions
 
+
 log = logging.getLogger(__name__)
 
 
@@ -79,6 +80,7 @@
 Es wurden für %s Fallakten erfolgreich die Vertretung zugewiesen. Bitte
 klicken Sie auf "OK", um fortzufahren."""
 
+
 class CaseBundleController(BaseController):
 
     def index(self):
@@ -88,14 +90,14 @@
         validator = BundleActionForm()
         log.debug(request.params)
         try:
-            # Check submitted fields 
+            # Check submitted fields
             form_result = validator.to_python(request.params)
             log.debug(form_result)
 
             # Check if the user has selected any cases
             if len(form_result.get('case_id', [])) <= 0 and \
             not form_result.get('all_cases'):
-                return self._empty_caselist() 
+                return self._empty_caselist()
 
             # Build case bundle
             case_bundle = self._build_casebundle(form_result)
@@ -107,24 +109,27 @@
                 return self.no_action()
             if action == 'markdelete':
                 # Fiter out case which are not open(1) or inactive (2)
-                case_bundle = self._filterBundle(case_bundle, allowedstates=(1, 2))
+                case_bundle = self._filterBundle(case_bundle,
+                                                 allowedstates=(1, 2))
                 if case_bundle.isEmpty():
                     return self._empty_caselist()
                 session['casebundle'] = case_bundle
                 session.save()
                 return self.markDelete(0)
             if action == 'delete':
-                # Fiter out case which are not marked for deletion 
-                case_bundle = self._filterBundle(case_bundle, allowedstates=(3,))
+                # Fiter out case which are not marked for deletion
+                case_bundle = self._filterBundle(case_bundle,
+                                                 allowedstates=(3,))
                 if case_bundle.isEmpty():
                     return self._empty_caselist()
                 session['casebundle'] = case_bundle
                 session.save()
                 return self.delete(0)
             if action == 'markanonymize':
-                # Fiter out case which are not open(1) or inactive (2) or not anonymizable 
-                case_bundle = self._filterBundle(case_bundle, 
-                                                 allowedstates=(1, 2), 
+                # Fiter out case which are not open(1) or inactive (2)
+                # or not anonymizable
+                case_bundle = self._filterBundle(case_bundle,
+                                                 allowedstates=(1, 2),
                                                  filter_notanonymizable=True)
                 if case_bundle.isEmpty():
                     return self._empty_caselist()
@@ -134,7 +139,7 @@
             if action == 'restore':
                 # Filter out cases which aren't marked for anonymization (4),
                 # or marked for deletion (3)
-                case_bundle = self._filterBundle(case_bundle, 
+                case_bundle = self._filterBundle(case_bundle,
                                                  allowedstates=(3, 4))
                 if case_bundle.isEmpty():
                     return self._emptyListError()
@@ -147,8 +152,7 @@
                 user = session['USER_AUTHORIZED']
                 filtered = []
                 for case in case_bundle.getCases():
-                    if (case.getEditor().id != user.id
-                        and not user.isAdmin()):
+                    if (case.getEditor().id != user.id and not user.isAdmin()):
                         filtered.append(case.id)
 
                 # Fiter out case which are not open(1) or inavtice (2)
@@ -192,7 +196,8 @@
             raise
         return "bundleAction"
 
-    def _filterBundle(self, case_bundle, allowedstates, filtered_cases=None, filter_notanonymizable=False):
+    def _filterBundle(self, case_bundle, allowedstates, filtered_cases=None,
+                      filter_notanonymizable=False):
         """Returns a filtered CaseBundle. Filtering can be done on
         states and on case_ids.
         """
@@ -227,9 +232,10 @@
             # If the user is admin then he should see only cases
             # which are marked for deletion or anonymisation
             if user.isAdmin():
-                FORM_DEFAULTS = g.mpuls_config.get('search', 'admin_defaults')[0] 
+                FORM_DEFAULTS = g.mpuls_config.get('search',
+                                                   'admin_defaults')[0]
             else:
-                FORM_DEFAULTS = g.mpuls_config.get('search', 'cm_defaults')[0] 
+                FORM_DEFAULTS = g.mpuls_config.get('search', 'cm_defaults')[0]
 
             search_options = (session.get('CASE_OVERVIEW_SEARCHOPTIONS')
                               or FORM_DEFAULTS)
@@ -243,7 +249,7 @@
     def _empty_caselist(self):
         c.url_ok = "/case_overview"
         c.dialog_title = BUNDLE_NOTIFICATION_EMPTYLIST_HEADER
-        c.dialog_text  = BUNDLE_NOTIFICATION_EMPTYLIST
+        c.dialog_text = BUNDLE_NOTIFICATION_EMPTYLIST
         return render('/casebundle/dialogs/error.mako')
 
     #
@@ -271,7 +277,7 @@
             c.context = "../main.mako"
             c.dialog_title = DIALOG_CONFIRM_DELETE
             c.dialog_text = (DIALOG_CONFIRM_EXPLAINATION
-                          % "\n".join(self._buildCaseList(case_bundle)))
+                             % "\n".join(self._buildCaseList(case_bundle)))
             c.url_yes = "/case_bundle/markDelete/1"
             c.url_no = "/case_overview/"
             return render('/casemanagement/dialogs/confirm.mako')
@@ -291,7 +297,7 @@
         else:
             c.dialog_title = DIALOG_CONFIRM_DELETE
             c.dialog_text = (DIALOG_CONFIRM_EXPLAINATION
-                          % "\n".join(self._buildCaseList(case_bundle)))
+                             % "\n".join(self._buildCaseList(case_bundle)))
             c.url_yes = "/case_bundle/delete/1"
             c.url_no = "/case_overview/"
             return render('/casemanagement/dialogs/confirm.mako')
@@ -312,7 +318,7 @@
         else:
             c.dialog_title = DIALOG_CONFIRM_MARKANONYMIZE
             c.dialog_text = (DIALOG_CONFIRM_MARKANONYMIZE_EXPLAINATION
-                          % "\n".join(self._buildCaseList(case_bundle)))
+                             % "\n".join(self._buildCaseList(case_bundle)))
             c.url_yes = "/case_bundle/markAnonymize/1"
             c.url_no = "/case_overview/"
             return render('/casebundle/dialogs/confirm_anonymize.mako')
@@ -332,7 +338,7 @@
         else:
             c.dialog_title = DIALOG_CONFIRM_ANONYMIZE
             c.dialog_text = (DIALOG_CONFIRM_ANONYMIZE_EXPLAINATION
-                          % "\n".join(self._buildCaseList(case_bundle)))
+                             % "\n".join(self._buildCaseList(case_bundle)))
             c.url_yes = "/case_overview/anonymize/1"
             c.url_no = "/case_overview/"
             return render('/casebundle/dialogs/confirm_anonymize.mako')
@@ -353,7 +359,7 @@
         else:
             c.dialog_title = DIALOG_CONFIRM_RESTORE
             c.dialog_text = (DIALOG_CONFIRM_RESTORE_EXPLAINATION
-                          % "\n".join(self._buildCaseList(case_bundle)))
+                             % "\n".join(self._buildCaseList(case_bundle)))
             c.url_yes = "/case_bundle/restore/1"
             c.url_no = "/case_overview/"
             return render('/casemanagement/dialogs/confirm_restore.mako')
@@ -368,9 +374,9 @@
             form_result = validator.to_python(request.params)
             num = case_bundle.setEditor(form_result.get('editor'))
             user = UserObject(form_result.get('editor'))
-            c.dialog_title = TRANSFER_SUCCESS_HEADER 
+            c.dialog_title = TRANSFER_SUCCESS_HEADER
             c.dialog_text= (TRANSFER_SUCCESS_TEXT
-                                  % (str(num), user.first_name, user.last_name))
+                            % (str(num), user.first_name, user.last_name))
             c.url_ok = "/case_overview"
             del session['casebundle']
             return render('/casebundle/dialogs/success_editor.mako')
@@ -387,7 +393,7 @@
         try:
             form_result = validator.to_python(request.params)
             num = case_bundle.setStandin(form_result.get('standin'))
-            c.dialog_title = STANDIN_SUCCESS_HEADER 
+            c.dialog_title = STANDIN_SUCCESS_HEADER
             c.dialog_text = STANDIN_SUCCESS_TEXT % str(num)
             c.url_ok = "/case_overview"
             del session['casebundle']



More information about the Mpuls-commits mailing list