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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 11 18:01:30 CET 2010


Author: bh
Date: 2010-03-11 18:01:26 +0100 (Thu, 11 Mar 2010)
New Revision: 1937

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/controllers/formularpage.py
Log:
* mpulsweb/controllers/formularpage.py (convert_error_items):
New. Combines convertErrorItem2ErrorDic and
convertErrorItem2ValueDic
(convertErrorItem2ErrorDic)
(convertErrorItem2ValueDic): Removed.
(get_rendered_page): Use convert_error_items instead of
convertErrorItem2ErrorDic and convertErrorItem2ValueDic


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-03-11 16:21:21 UTC (rev 1936)
+++ wasko/branches/2.0/ChangeLog	2010-03-11 17:01:26 UTC (rev 1937)
@@ -1,5 +1,15 @@
 2010-03-11  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/controllers/formularpage.py (convert_error_items):
+	New. Combines convertErrorItem2ErrorDic and
+	convertErrorItem2ValueDic
+	(convertErrorItem2ErrorDic)
+	(convertErrorItem2ValueDic): Removed.
+	(get_rendered_page): Use convert_error_items instead of
+	convertErrorItem2ErrorDic and convertErrorItem2ValueDic
+
+2010-03-11  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/formularpage.py
 	(convertErrorItem2WarningDic): removed.  Not used anymore.
 

Modified: wasko/branches/2.0/mpulsweb/controllers/formularpage.py
===================================================================
--- wasko/branches/2.0/mpulsweb/controllers/formularpage.py	2010-03-11 16:21:21 UTC (rev 1936)
+++ wasko/branches/2.0/mpulsweb/controllers/formularpage.py	2010-03-11 17:01:26 UTC (rev 1937)
@@ -27,23 +27,15 @@
 log = logging.getLogger(__name__)
 
 
-def convertErrorItem2ErrorDic(error_items):
-    if error_items is None:
-        return {}
+def convert_error_items(error_items):
     errors = {}
+    defaults = {}
     for items in error_items:
         for e in items:
             errors[e.name] = e.msg
-    return errors
+            defaults[e.name] = e.bad
+    return errors, defaults
 
-def convertErrorItem2ValueDic(error_items):
-    if error_items is None:
-        return {}
-    errors = {}
-    for items in error_items:
-        for e in items:
-            errors[e.name] = e.bad
-    return errors
 
 def convert2dic(params):
     result = {}
@@ -82,9 +74,8 @@
     log.debug('Getting page "%s"' % id)
     page = instance_tree.getItem(id)
 
-    errors = convertErrorItem2ErrorDic(page.getErrors())
     warnings = {}
-    defaults = convertErrorItem2ValueDic(page.getErrors())
+    errors, defaults = convert_error_items(page.getErrors())
 
     if page:
         c.formularheader = ("<h1>%s</h1>"



More information about the Mpuls-commits mailing list