diff options
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | TODO | 9 | ||||
-rw-r--r-- | src/Compiler.py | 12 | ||||
-rw-r--r-- | src/Template.py | 12 |
4 files changed, 14 insertions, 24 deletions
@@ -38,12 +38,9 @@ release MIGHT BREAK EXISTING CODE (TR) - Install Cheetah into site-packages/Cheetah/ rather than site-packages/Webware/Cheetah/. Added code to automatically remove the old dir.(TR) - - added __builtin__ to the end of the searchList so that other searchList - variables can override Python builtins. The old implementation allowed - builtins to trump searchList vars. (TR) - fixed the variable name resolution order bug in $placeholders. The new implementation uses - valueFromSearchList([locals()] + searchList + [globals()], rest of the args) + valueFromSearchList([locals()] + searchList + [globals(), __builtin__], rest of the args) for all lookups. (TR) - removed the #settings directive (TR) - added the #del directive, for using Python's del statement (TR) @@ -52,15 +52,6 @@ Boolean argument 'all' adds local variables, builtins, etc. Boolean argument - 'errorCatcher None' to stop catching errors in the middle of a template. -- #del is the only statement that's missing, and there seems to be no other way - to do it. #silent wants an expression, not a statement. I'm mainly thinking - about deleting keys from local dictionaries -- delattr() doesn't do this -- - but there's no reason it shouldn't work on local subscripts, attributes and - variables too. Leave open the possibility for '#del global' (opposite of - '#set global') in the future if it's needed, and - '#del searchList $var["key"]' too. I don't know about '#del searchList $var': - that could be hard to implement, but maybe somebody will want it someday. - - Finish up changes to #indent so that it matches the Users' Guide. (MO) diff --git a/src/Compiler.py b/src/Compiler.py index 0f08487..eef1189 100644 --- a/src/Compiler.py +++ b/src/Compiler.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# $Id: Compiler.py,v 1.45 2002/10/05 21:38:09 tavis_rudd Exp $ +# $Id: Compiler.py,v 1.46 2002/10/05 22:12:00 tavis_rudd Exp $ """Compiler classes for Cheetah: ModuleCompiler aka 'Compiler' ClassCompiler @@ -12,12 +12,12 @@ ModuleCompiler.compile, and ModuleCompiler.__getattr__. Meta-Data ================================================================================ Author: Tavis Rudd <tavis@damnsimple.com> -Version: $Revision: 1.45 $ +Version: $Revision: 1.46 $ Start Date: 2001/09/19 -Last Revision Date: $Date: 2002/10/05 21:38:09 $ +Last Revision Date: $Date: 2002/10/05 22:12:00 $ """ __author__ = "Tavis Rudd <tavis@damnsimple.com>" -__revision__ = "$Revision: 1.45 $"[11:-2] +__revision__ = "$Revision: 1.46 $"[11:-2] ################################################## ## DEPENDENCIES @@ -176,7 +176,7 @@ class GenUtils: # + chunk[2]) #else: - translatedName = ('VFS([locals()] + SL + [globals()],"' + chunk[0] + + translatedName = ('VFS([locals()] + SL + [globals(), __builtin__],"' + chunk[0] + '",' + str(autoCall and chunk[1]) + ')' + chunk[2]) @@ -566,6 +566,7 @@ class AutoMethodCompiler(MethodCompiler): ("currentTime","time.time"), ("globals","globals"), ("locals","locals"), + ("__builtin__","__builtin__"), ]: self.addMethArg(argName, defVal) @@ -1032,6 +1033,7 @@ class ModuleCompiler(Parser, GenUtils): "from os.path import getmtime, exists", "import time", "import types", + "import __builtin__", "from Cheetah.Template import Template", "from Cheetah.DummyTransaction import DummyTransaction", "from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList", diff --git a/src/Template.py b/src/Template.py index f4a6ace..b9ba2fc 100644 --- a/src/Template.py +++ b/src/Template.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# $Id: Template.py,v 1.102 2002/10/05 21:41:17 tavis_rudd Exp $ +# $Id: Template.py,v 1.103 2002/10/05 22:12:00 tavis_rudd Exp $ """Provides the core Template class for Cheetah See the docstring in __init__.py and the User's Guide for more information @@ -8,12 +8,12 @@ Meta-Data Author: Tavis Rudd <tavis@damnsimple.com> License: This software is released for unlimited distribution under the terms of the Python license. -Version: $Revision: 1.102 $ +Version: $Revision: 1.103 $ Start Date: 2001/03/30 -Last Revision Date: $Date: 2002/10/05 21:41:17 $ +Last Revision Date: $Date: 2002/10/05 22:12:00 $ """ __author__ = "Tavis Rudd <tavis@damnsimple.com>" -__revision__ = "$Revision: 1.102 $"[11:-2] +__revision__ = "$Revision: 1.103 $"[11:-2] ################################################## ## DEPENDENCIES @@ -35,7 +35,8 @@ from tempfile import mktemp import imp import traceback -import __builtin__ # this is added to the end of the searchList +import __builtin__ + # Base classes for Template (intra-package imports) from SettingsManager import SettingsManager from Servlet import Servlet @@ -163,7 +164,6 @@ class Template(SettingsManager, Servlet, WebInputMixin): self._searchList = [self._globalSetVars] self._searchList.extend(list(searchList)) self._searchList.append( self ) - self._searchList.append( __builtin__ ) ################################################## ## setup the ouput filters |