[Formed-commits] r321 - in trunk: . formed/formed/model
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Mar 31 12:08:00 CEST 2009
Author: teichmann
Date: 2009-03-31 12:08:00 +0200 (Tue, 31 Mar 2009)
New Revision: 321
Modified:
trunk/ChangeLog
trunk/formed/formed/model/exprtree.py
Log:
Expr engine:
* Fixes from server
* Raise exceptions if there is less or more than one element on stack
after compilation of expression.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-20 14:40:36 UTC (rev 320)
+++ trunk/ChangeLog 2009-03-31 10:08:00 UTC (rev 321)
@@ -1,3 +1,9 @@
+2009-03-31 Sascha L. Teichmann <teichmann at intevation.de>
+
+ * formed/formed/model/exprtree.py: Fixes from server. Raise
+ exceptions if there is less or more than one element on stack
+ after compilation of expression.
+
2009-03-20 Sascha L. Teichmann <teichmann at intevation.de>
* formed/formed/model/data.py: Removed debug output
Modified: trunk/formed/formed/model/exprtree.py
===================================================================
--- trunk/formed/formed/model/exprtree.py 2009-03-20 14:40:36 UTC (rev 320)
+++ trunk/formed/formed/model/exprtree.py 2009-03-31 10:08:00 UTC (rev 321)
@@ -160,7 +160,7 @@
def eval(self, ctx):
day = self.day.eval(ctx)
- month = self.mounth.eval(ctx)
+ month = self.month.eval(ctx)
year = self.year.eval(ctx)
return date(year, month, day)
@@ -170,8 +170,8 @@
self.parent = parent
def eval(self, ctx):
- e = self.parent(ctx)
- print repr(e)
+ e = self.parent.eval(ctx)
+ print >> sys.stderr, "OUT: %s" % repr(e)
return e
class IThenElse(Node):
@@ -298,7 +298,12 @@
except KeyError:
stack.append(Const(token))
- self.prog = stack and stack[0] or None
+ L = len(stack)
+
+ if L < 1: raise Exception("No elements on stack!")
+ if L > 1: raise Exception("Too much elements (%d) on stack!" % L)
+
+ self.prog = stack[0]
self.depends = depends
def getDependencies(self):
More information about the Formed-commits
mailing list