[Mpuls-commits] r1925 - in waska/trunk: . formed waskaweb/lib waskaweb/model

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Mar 11 11:37:08 CET 2010


Author: roland
Date: 2010-03-11 11:37:07 +0100 (Thu, 11 Mar 2010)
New Revision: 1925

Modified:
   waska/trunk/ChangeLog
   waska/trunk/formed/formedtree_web.xml
   waska/trunk/waskaweb/lib/renderer.py
   waska/trunk/waskaweb/model/expr.py
Log:
Backported the isset operator (formed tree) to waska

Modified: waska/trunk/ChangeLog
===================================================================
--- waska/trunk/ChangeLog	2010-03-10 14:57:37 UTC (rev 1924)
+++ waska/trunk/ChangeLog	2010-03-11 10:37:07 UTC (rev 1925)
@@ -1,3 +1,12 @@
+2010-03-11	Roland Geider <roland.geider at intevation.de>
+
+	Backported the isset operator for the formed tree
+
+	* waskaweb/model/expr.py: Backported the isset operator for the formed tree
+	* waskaweb/lib/renderer.py: Added special handling of date comparisons because
+          of lack of short-circuiting in waska
+        * formed/formedtree_web.xml: Don't block the date 1.1.2010
+
 2010-03-10 Torsten Irländer <torsten.irlaender at intevation.de>
 
 	Set version to 1.7.0

Modified: waska/trunk/formed/formedtree_web.xml
===================================================================
--- waska/trunk/formed/formedtree_web.xml	2010-03-10 14:57:37 UTC (rev 1924)
+++ waska/trunk/formed/formedtree_web.xml	2010-03-11 10:37:07 UTC (rev 1925)
@@ -595,7 +595,7 @@
               <bool description="Ja" name="Ja" value="1"/>
               <bool description="Nein" name="Nein" value="0"/>
             </choice>
-            <conditional expr="$datum_feststellung isset not $datum_feststellung 1 1 2010 date > or" name="conditional-11" target="a">
+            <conditional expr="$datum_feststellung isset not $datum_feststellung 1 1 2010 date >= or" name="conditional-11" target="a">
                 <date description="Datum der Entscheidung" flags="required:clearing_ende,beratung_start,cm_start;time:clearing_ende,cm_start,beratung_start" name="datum_feststellung" target="b"/>
             </conditional>
           </group>
@@ -1541,7 +1541,7 @@
             <int description="Zeitraum CM (in Wochen)" flags="evaluation" formularname="Zeitraum_Fallmanagement" maxvalue="250" minvalue="0" name="zeitraum_fallmanagement" target="b"/>
           </group>
           <group containers="a,b,c" description="Angaben zur Beendigung des CM" name="angabenzurbeendigungdescm" target="c">
-              <conditional expr="$beendigung_5 isset not $beendigung_5 1 1 2010 date > or" name="conditional-12" target="a">
+              <conditional expr="$beendigung_5 isset not $beendigung_5 1 1 2010 date >= or" name="conditional-12" target="a">
                 <date description="Beendigung CM (Datum)" flags="required:cm_ende,nachbetreuung_start;time:cm_ende,nachbetreuung_start" formularname="Beendigung" name="beendigung_5" target="a"/>
             </conditional>
             <choice description="Art der Beendigung" flags="evaluation;required:cm_ende" formularname="Art_Beendigung" name="art_beendigung" size="1" target="a">

Modified: waska/trunk/waskaweb/lib/renderer.py
===================================================================
--- waska/trunk/waskaweb/lib/renderer.py	2010-03-10 14:57:37 UTC (rev 1924)
+++ waska/trunk/waskaweb/lib/renderer.py	2010-03-11 10:37:07 UTC (rev 1925)
@@ -204,7 +204,7 @@
             values[d] = self.page.getData(d)
         try:
             ok = expr.evaluate(values)
-        except:
+        except Exception, e:
             ok = False
         return ok
 

Modified: waska/trunk/waskaweb/model/expr.py
===================================================================
--- waska/trunk/waskaweb/model/expr.py	2010-03-10 14:57:37 UTC (rev 1924)
+++ waska/trunk/waskaweb/model/expr.py	2010-03-11 10:37:07 UTC (rev 1925)
@@ -111,7 +111,12 @@
         def _GT(self):
             stack = self.stack
             b = stack.pop()
-            stack.append(stack.pop() > b)
+            c = stack.pop()
+            # Special handling of datecomparision. Beacuse of missing isset functionallity (short circuiting)
+            if isinstance(b, date) and c is None:
+                stack.append(True)
+            else:
+                stack.append(c > b)
 
         def _LT(self):
             stack = self.stack
@@ -121,7 +126,12 @@
         def _GE(self):
             stack = self.stack
             b = stack.pop()
-            stack.append(stack.pop() >= b)
+            c = stack.pop()
+            # Special handling of datecomparision. Beacuse of missing isset functionallity (short circuiting)
+            if isinstance(b, date) and c is None:
+                stack.append(True)
+            else:
+                stack.append(c >= b)
 
         def _LE(self):
             stack = self.stack
@@ -132,6 +142,11 @@
             stack = self.stack
             b = stack.pop()
             stack.append(stack.pop() and b)
+        
+        def _ISSET(self):
+            stack = self.stack
+            top = stack.pop()
+            stack.append(top is not None)
 
         def _OR(self):
             stack = self.stack
@@ -214,6 +229,7 @@
             'not':   _NOT,
             'or':    _OR,
             'and':   _AND,
+            'isset': _ISSET,
             'type':  _TYPE,
             'DUP':   _DUP,
             'date':  _DATE,



More information about the Mpuls-commits mailing list