[Mpuls-commits] r591 - in wasko/branches/1.0: . waskaweb/controllers waskaweb/templates/dialogs

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Sep 4 11:26:32 CEST 2009


Author: frank
Date: 2009-09-04 11:26:30 +0200 (Fri, 04 Sep 2009)
New Revision: 591

Modified:
   wasko/branches/1.0/ChangeLog.txt
   wasko/branches/1.0/waskaweb/controllers/case.py
   wasko/branches/1.0/waskaweb/controllers/case_overview.py
   wasko/branches/1.0/waskaweb/templates/dialogs/failed.mako
Log:
Activate new barriers also for cases with pending anonymization.


Modified: wasko/branches/1.0/ChangeLog.txt
===================================================================
--- wasko/branches/1.0/ChangeLog.txt	2009-09-04 09:06:33 UTC (rev 590)
+++ wasko/branches/1.0/ChangeLog.txt	2009-09-04 09:26:30 UTC (rev 591)
@@ -1,3 +1,18 @@
+2009-09-04	Frank Koormann <frank.koormann at intevation.de>
+
+	Activate new barriers also for cases with pending anonymization.
+
+	* waskaweb/controllers/case_overview.py 
+	(CaseOverviewController.bundleAction): Check inconsistancies before 
+	anonymizing.
+	
+	* waskaweb/controllers/case.py (CaseController.anonymize):
+	Added full consistancy check before asking for confirmation.
+
+	* waskaweb/templates/dialogs/failed.mako: Removed call of "h", since it
+	caused encoding corruption of messages.
+
+ 
 2009-08-25	Frank Koormann <frank.koormann at intevation.de>
 
 	Release 1.0.6

Modified: wasko/branches/1.0/waskaweb/controllers/case.py
===================================================================
--- wasko/branches/1.0/waskaweb/controllers/case.py	2009-09-04 09:06:33 UTC (rev 590)
+++ wasko/branches/1.0/waskaweb/controllers/case.py	2009-09-04 09:26:30 UTC (rev 591)
@@ -1439,8 +1439,21 @@
         confirmed = self._checkBool(confirmed)
         c.ds_id   = id
         #c.form_navigation = self._getFormNavigation()
+        # Check if the case is in a consistent state (all required fields
+        # are filled)
+        case = self._loadCase(id)
+        if (not case.getState().phasesAreConsistent() or not case.getState().phasesAreCompleted()) and case.isYoungerThan(INCONSISTENCY_CHECK_AFTER):
+            c.failed_for  = MARKANONYMIZE_INCOMPLETE_PHASE_FAILED 
+            if case.getState().getPhase() in (CLEAR_START, CLEAR_ENDE):
+                c.failed_text = \
+                            MARKANONYMIZE_CLEARING_PHASE_FAILED_TEXT
+            else:    
+                c.failed_text = \
+                            MARKANONYMIZE_INCOMPLETE_PHASE_FAILED_TEXT
+            c.url_ok            = "/case/digest/%s" % id
+            return render('/casemanagement/dialogs/failed_anonymize.mako')
+
         if confirmed == 1:
-            case = self._loadCase(id)
             if case.anonymize():
                 c.success_for   =  ANONYMIZE_SUCCESS
                 c.success_text  =  ANONYMIZE_SUCCESS_TEXT

Modified: wasko/branches/1.0/waskaweb/controllers/case_overview.py
===================================================================
--- wasko/branches/1.0/waskaweb/controllers/case_overview.py	2009-09-04 09:06:33 UTC (rev 590)
+++ wasko/branches/1.0/waskaweb/controllers/case_overview.py	2009-09-04 09:26:30 UTC (rev 591)
@@ -376,7 +376,7 @@
 
             if action == 'anonymize':
                 # Filter out cases which aren't marked for anonymization (4)
-                case_bundle = self._filterBundle(case_bundle, [4])
+                case_bundle = self._filterBundle(case_bundle, [4], filter_inconsistent=True)
                 if case_bundle.isEmpty(): return self._emptyListError()
                 session['casebundle'] = case_bundle
                 session.save()
@@ -471,7 +471,7 @@
         return self.overview()
 
     def _filterBundle(self, case_bundle, allowedstates, filtered_cases=None, filter_inconsistent=False):
-        '''Returns a filtered CaseBundle. kiltering can be done on states and on inconsistent cases (not all required fields are filled for current phase)'''
+        '''Returns a filtered CaseBundle. Filtering can be done on states and on inconsistent cases (not all required fields are filled for current phase)'''
         filtered = []
         for case in case_bundle.getCases(filtered_cases):
             state = case.getState()

Modified: wasko/branches/1.0/waskaweb/templates/dialogs/failed.mako
===================================================================
--- wasko/branches/1.0/waskaweb/templates/dialogs/failed.mako	2009-09-04 09:06:33 UTC (rev 590)
+++ wasko/branches/1.0/waskaweb/templates/dialogs/failed.mako	2009-09-04 09:26:30 UTC (rev 591)
@@ -1,7 +1,7 @@
 ## -*- coding: utf-8 -*-
 <%!  import waskaweb.lib.filters as F %>
 <div class="dialog" />
-<h1><img src="/images/failure.png" alt="Erledigt"/>${c.failed_for | F.NA, h}</h1>
-<p>${c.failed_text | F.NA, h}</p>
+<h1><img src="/images/failure.png" alt="Fehler"/>${c.failed_for | F.NA, h}</h1>
+<p>${c.failed_text | F.NA}</p>
 <a class="button" href="${c.url_ok}">${_('dialog_header_confirm_option_ok')}</a>
 </div>



More information about the Mpuls-commits mailing list