summaryrefslogtreecommitdiff
path: root/dummyengine.py
diff options
context:
space:
mode:
authorStephan Richter <stephan.richter@gmail.com>2004-03-23 19:18:17 +0000
committerStephan Richter <stephan.richter@gmail.com>2004-03-23 19:18:17 +0000
commit6aa72b43643eab5364b88be12fcd2cc177a0b7cc (patch)
treeaf34c8774634623e7a39086ebb8a2e82624db479 /dummyengine.py
parent24a68683cb90144265d2efa6df109348b277d0f6 (diff)
downloadzope-tal-6aa72b43643eab5364b88be12fcd2cc177a0b7cc.tar.gz
Added getValue(name, default) to engine.
Diffstat (limited to 'dummyengine.py')
-rw-r--r--dummyengine.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/dummyengine.py b/dummyengine.py
index 6927a74..624cd7c 100644
--- a/dummyengine.py
+++ b/dummyengine.py
@@ -13,7 +13,7 @@
##############################################################################
"""Dummy TAL expression engine so that I can test out the TAL implementation.
-$Id: dummyengine.py,v 1.15 2004/03/08 23:33:58 srichter Exp $
+$Id: dummyengine.py,v 1.16 2004/03/23 19:18:17 srichter Exp $
"""
import re
@@ -80,6 +80,12 @@ class DummyEngine:
def setGlobal(self, name, value):
self.globals[name] = value
+ def getValue(self, name, default=None):
+ value = self.globals.get(name, default)
+ if value is default:
+ value = self.locals.get(name, default)
+ return value
+
def evaluate(self, expression):
assert (expression.startswith("$") and expression.endswith("$"),
expression)