[Mpuls-commits] r3345 - wasko/trunk/waskoweb/controllers

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 9 12:21:29 CEST 2010


Author: torsten
Date: 2010-08-09 12:21:26 +0200 (Mon, 09 Aug 2010)
New Revision: 3345

Modified:
   wasko/trunk/waskoweb/controllers/caselifetime.py
Log:
Fixed issue866


Modified: wasko/trunk/waskoweb/controllers/caselifetime.py
===================================================================
--- wasko/trunk/waskoweb/controllers/caselifetime.py	2010-08-09 09:42:51 UTC (rev 3344)
+++ wasko/trunk/waskoweb/controllers/caselifetime.py	2010-08-09 10:21:26 UTC (rev 3345)
@@ -98,21 +98,16 @@
 # items not to be copied from old case
 COPY_BLACK_LIST = frozenset(['erstgespraech', 'datum_cm_start'])
 
-class DataSaveException(SetDataException):
 
-    def toErrorDicts(self):
+def toErrorDicts(e):
+    values, errors = {}, {}
+    for key, err in e.errors.iteritems():
+        key = key.split(':')[0]
+        for e in err:
+            values[key] = e.bad
+            errors[key] = e.msg
+    return values, errors
 
-        values, errors = {}, {}
-
-        for key, value, error in self.errors:
-            values[key] = value
-            try:
-                old = errors[key]
-                errors[key] = u"%s, %s" % (old, error)
-            except KeyError:
-                errors[key] = error
-        return values, errors
-
 def create_logbook(id=None, header=None, text=None):
     if id is None:
         id = session['case'].id
@@ -387,8 +382,8 @@
                                text=('Für den Fall wurde eine Verlängerung'
                                      ' des Integrationsprozess dokumentiert.'))
                 return self.index(session['case'].id)
-            except DataSaveException, err:
-                form_result, form_errors = err.toErrorDicts()
+            except SetDataException, err:
+                form_result_1, form_errors = toErrorDicts(err)
         except formencode.Invalid, error:
             form_result = error.value
             form_errors = error.error_dict or {}
@@ -624,8 +619,8 @@
                     return self.reopen_ok(session['case'].id)
                 else:
                     return self.reopen_notok(session['case'].id)
-            except DataSaveException, err:
-                form_result, form_errors = err.toErrorDicts()
+            except SetDataException, err:
+                form_result_1, form_errors = toErrorDicts(err)
         except formencode.Invalid, error:
             #TODO: use htmlfill
             form_result = error.value
@@ -658,8 +653,8 @@
                     return self.renew_ok(case_id)
                 else:
                     return self.renew_notok(case_id)
-            except DataSaveException, err:
-                form_result, form_errors = err.toErrorDicts()
+            except SetDataException, err:
+                form_result_1, form_errors = toErrorDicts(err)
 
         except formencode.Invalid, error:
             form_result = error.value



More information about the Mpuls-commits mailing list