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

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Mar 5 10:57:38 CET 2010


Author: bh
Date: 2010-03-05 10:57:38 +0100 (Fri, 05 Mar 2010)
New Revision: 1898

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/renderer.py
Log:
* mpulsweb/lib/renderer.py (ViewRenderer._renderConditional):
Evaluate the conditional's expression and render the conditional
depending on its result.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-03-05 09:55:59 UTC (rev 1897)
+++ wasko/branches/2.0/ChangeLog	2010-03-05 09:57:38 UTC (rev 1898)
@@ -1,3 +1,9 @@
+2010-03-05  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/renderer.py (ViewRenderer._renderConditional):
+	Evaluate the conditional's expression and render the conditional
+	depending on its result.
+
 2010-03-04  Bernhard Herzog  <bh at intevation.de>
 
 	* mpulsweb/lib/renderer.py (ViewRenderer._renderConditional): Remove

Modified: wasko/branches/2.0/mpulsweb/lib/renderer.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-03-05 09:55:59 UTC (rev 1897)
+++ wasko/branches/2.0/mpulsweb/lib/renderer.py	2010-03-05 09:57:38 UTC (rev 1898)
@@ -38,6 +38,7 @@
 import formed.meta.data as data
 from formed.meta.nodecomponents import Node, NodeComponent as MetaNodeComponent
 from formed.instance.tree import RepeatInstanceContainerNode
+from formed.instance.backends.common import RuleEvalContext
 
 from mpulsweb.lib.helper.filters import NA
 from mpulsweb.lib.helpers import dd_mm_YYYY as format_date
@@ -461,7 +462,13 @@
 
     def _renderConditional(self, conditional):
         meta = self._getMeta(conditional)
-        if True: #meta.evaluate():
+        expr = meta.getExpr()
+        if expr is not None:
+            context = RuleEvalContext(self.it, conditional.getIdentifier())
+            available = expr.evaluate(context)
+        else:
+            available = False
+        if not available:
             ro = not meta.isInvisible()
             if ro:
                 old_ro = self.ro_mode



More information about the Mpuls-commits mailing list