summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorR. Tyler Ballance <tyler@slide.com>2009-03-24 10:57:41 -0700
committerR. Tyler Ballance <tyler@slide.com>2009-03-24 10:57:41 -0700
commit2d72b61c956474af0784f53d2b06f0e2c5f0473f (patch)
tree7a8269e0a3d733c1f8e730e10630f30f0b1bb4b6
parent2410fa3bcc14a28a8f19120e0198a05334b1df6b (diff)
downloadpython-cheetah-2d72b61c956474af0784f53d2b06f0e2c5f0473f.tar.gz
Prioritize the template itself at the beginning of the searchList.
Patch suggested by Peter Warasin <peter@endian.com> to solve an issue when using the RecursiveNull class in your searchList. What this will do for the majority case however is prevent searchlist variables from colliding with template defined variables or methods. In effect, if your template has: #def $mymethod() #return 'foo' #end def And you pass the searchList=[{'mymethod' : lambda x: 'bar'}], the template will resolve the "mymethod" symbol defined in the template itself. Signed-off-by: R. Tyler Ballance <tyler@slide.com>
-rw-r--r--src/Template.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/Template.py b/src/Template.py
index 9d4114c..ee9c7bf 100644
--- a/src/Template.py
+++ b/src/Template.py
@@ -1413,10 +1413,9 @@ class Template(Servlet):
self._CHEETAH__searchList.append(self)
else:
# create our own searchList
- self._CHEETAH__searchList = [self._CHEETAH__globalSetVars]
+ self._CHEETAH__searchList = [self._CHEETAH__globalSetVars, self]
if searchList is not None:
self._CHEETAH__searchList.extend(list(searchList))
- self._CHEETAH__searchList.append( self )
self._CHEETAH__cheetahIncludes = {}
self._CHEETAH__cacheRegions = {}
self._CHEETAH__indenter = Indenter()