[Mpuls-commits] r2275 - in wasko/branches/2.0: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 1 16:18:09 CEST 2010


Author: bh
Date: 2010-04-01 16:18:09 +0200 (Thu, 01 Apr 2010)
New Revision: 2275

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._checkWarnings): The
values of the self.warnings dictionary are now lists so that there
can be multiple warnings per field.
(ErrorRenderer.render_items): Deal with the warnings having lists
of strings instead of strings.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-04-01 14:10:41 UTC (rev 2274)
+++ wasko/branches/2.0/ChangeLog	2010-04-01 14:18:09 UTC (rev 2275)
@@ -1,5 +1,13 @@
 2010-04-01  Bernhard Herzog  <bh at intevation.de>
 
+	* mpulsweb/lib/renderer.py (ViewRenderer._checkWarnings): The
+	values of the self.warnings dictionary are now lists so that there
+	can be multiple warnings per field.
+	(ErrorRenderer.render_items): Deal with the warnings having lists
+	of strings instead of strings.
+
+2010-04-01  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/repeatgroup.py
 	(RepeatgroupController.delete): Log exception if deleting a repeat
 	group fails

Modified: wasko/branches/2.0/mpulsweb/lib/renderer.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-01 14:10:41 UTC (rev 2274)
+++ wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-01 14:18:09 UTC (rev 2275)
@@ -367,7 +367,7 @@
         context = RuleEvalContext(self.it, id)
         for rule in rules:
             if not rule.getExpr().evaluate(context):
-                self.warnings[id] = rule.getValue()
+                self.warnings.setdefault(id, []).append(rule.getValue())
 
     def _renderGroup(self, node):
         meta = self._getMeta(node)
@@ -973,20 +973,25 @@
         out.append('</h1>')
         out.append('<ol>')
 
-        for k, v in items.iteritems():
+        for k, values in items.iteritems():
             element = tree.getFormEd().findByName(k.split(':')[0])
             description = element.getDescription()
-            out.append('<li>')
-            out.append(tag("a", href="/formularpage/undo/%s" % k))
-            out.append(tag("img", src="/images/icons/formular/undo.png",
-                           border="0", alt="undo",
-                           title=_('Restore last valid value'),
-                           _close=True))
-            out.append('</a>')
-            out.append(tag("a", class_="error", href="#f_%s" % k))
-            out.append("%s: %s" % (escape(description), escape(v)))
-            out.append("</a>")
-            out.append("</li>")
+            # the values in the items dict may either be strings or
+            # lists of strings.
+            if not isinstance(values, list):
+                values = [values]
+            for v in values:
+                out.append('<li>')
+                out.append(tag("a", href="/formularpage/undo/%s" % k))
+                out.append(tag("img", src="/images/icons/formular/undo.png",
+                               border="0", alt="undo",
+                               title=_('Restore last valid value'),
+                               _close=True))
+                out.append('</a>')
+                out.append(tag("a", class_="error", href="#f_%s" % k))
+                out.append("%s: %s" % (escape(description), escape(v)))
+                out.append("</a>")
+                out.append("</li>")
 
         out.append('</ol>')
         out.append('</div>')



More information about the Mpuls-commits mailing list