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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Apr 8 17:37:20 CEST 2010


Author: bh
Date: 2010-04-08 17:37:19 +0200 (Thu, 08 Apr 2010)
New Revision: 2287

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/renderer.py
Log:
Only show warnings for fields that are actually invalid.  This
fixes a bug related to rules and repeat groups.
Requires libformed revision 122:a0d531148af0.

* mpulsweb/lib/renderer.py (ViewRenderer._checkWarnings): Do not
show warnings for fields that are actually OK, as could happen
until now when repeat groups were involved in which case all
fields in all instances of a repeat group were marked even if only
one of them was actually invalid.  This is implemented by using
evaluate_instances to evaluate the warning rules expressions and
examining the individual results.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-04-08 14:43:19 UTC (rev 2286)
+++ wasko/branches/2.0/ChangeLog	2010-04-08 15:37:19 UTC (rev 2287)
@@ -1,5 +1,19 @@
 2010-04-08  Bernhard Herzog  <bh at intevation.de>
 
+	Only show warnings for fields that are actually invalid.  This
+	fixes a bug related to rules and repeat groups.
+	Requires libformed revision 122:a0d531148af0.
+
+	* mpulsweb/lib/renderer.py (ViewRenderer._checkWarnings): Do not
+	show warnings for fields that are actually OK, as could happen
+	until now when repeat groups were involved in which case all
+	fields in all instances of a repeat group were marked even if only
+	one of them was actually invalid.  This is implemented by using
+	evaluate_instances to evaluate the warning rules expressions and
+	examining the individual results.
+
+2010-04-08  Bernhard Herzog  <bh at intevation.de>
+
 	* mpulsweb/controllers/formularpage.py (get_rendered_page): Do not
 	show errors on a repeat group overview page (i.e. when rendering
 	an intance of RepeatInstanceContainerNode).  The links generated

Modified: wasko/branches/2.0/mpulsweb/lib/renderer.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-08 14:43:19 UTC (rev 2286)
+++ wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-04-08 15:37:19 UTC (rev 2287)
@@ -366,8 +366,9 @@
 
         context = RuleEvalContext(self.it, id)
         for rule in rules:
-            if not rule.getExpr().evaluate(context):
-                self.warnings.setdefault(id, []).append(rule.getValue())
+            for result, variables in rule.getExpr().evaluate_instances(context):
+                if not result and id in variables:
+                    self.warnings.setdefault(id, []).append(rule.getValue())
 
     def _renderGroup(self, node):
         meta = self._getMeta(node)



More information about the Mpuls-commits mailing list