Please initial your changes (there's a key at bottom) and add a date for each
release
================================================================================
2.0rc1 (Jan 10, 2006)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]
- made it possible nest #filter directives
- added lots more docstring content in the Template class
- added Template.subclass() classmethod for quickly creating subclasses of
existing Cheetah template classes. It takes the same args as the
.compile() classmethod and returns a template that is a subclass of the
template .subclass() is called from:
T1 = Template.compile(' foo - $meth1 - bar\n#def meth1: this is T1.meth1')
T2 = T1.subclass('#implements meth1\n this is T2.meth1')
- added baseclass arg to Template.compile(). It simplifies the reuse of
dynamically compiled templates:
# example 1, quickly subclassing a normal Python class and using its
# __init__ call signature:
dictTemplate = Template.compile('hello $name from $caller', baseclass=dict)
print dictTemplate(name='world', caller='me')
# example 2, mixing a Cheetah method into a class definition:
class Foo(dict):
def meth1(self):
return 'foo'
def meth2(self):
return 'bar'
Foo = Template.compile('#implements meth3\nhello $name from $caller',
baseclass=Foo)
print Foo(name='world', caller='me')
A side-benefit is the possibility to use the same Cheetah source with
several baseclass, as the baseclass is orthogonal to the source code,
unlike the #extends directive.
- added 'namespaces' as an alias for 'searchList' in Template.__init__
- made it possible to pass in a single namespace to 'searchList', which will
automatically be converted into a list.
- fixed issue with buffering and use of #call when template is used as a
webkit servlet
- added Cheetah.Utils.htmlEncode and htmlDecode
The command line tool (CheetahWrapper.py):
- changed insertion order for the --env and --pickle options so they match the
commandline UI of the compiled template modules themselves [TR]
2.0b5 (Jan 7, 2006)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]
- made Cheetah.Template a new-style class by inserting 'object' into its'
inheritance tree. Templates can now use super(), properties and all the
other goodies that come with new-style classes.
- removed the WebInputMixin by placing its one method directly in the
Template class.
- removed the SettingsManager Mixin. It wasn't being used by anything
anymore.
- added a framework for caching the results of compilations in
Template.compile(). This is on by default and protects against bad
performance issues that are due to programmers misguidedly compiling
templates inside tight loops. It also saves on memory usage.
- misc attr name changes to avoid namespace pollution
- more + improved docstrings
- replaced the oldstyle dynamic compile hacks with a wrapper around
Template.compile(). The old usage pattern Template(src) now benefits from
most of the recent changes.
Template(src).__class__ == Template.compile(src)
- removed all the extra imports required by oldstyle dynamic compile hacks
- converted the cheetah #include mechanism to newstyle compilation and made it
more flexible
- made the #include mechanism work with file objects in addition to file names
- made the handling of args to Template.compile() more flexible. You can now
provide defaults via class attributes.
- made preprocessors for Template.compile() work with file arguments
- added support for specifying a __metaclass__ on cheetah template classes
- refactored both the class and instance initialization processes
- improved the handling of __str__ in _assignRequiredMethodsToClass
The command line tool (CheetahWrapper.py): [TR]
- improved error output in CheetahWrapper
- switched fill command over to new style compile usage
Unit tests: [TR]
- fixed format string bug in unittest_local_copy.py
2.0b4 (Jan 6, 2006)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]
- fixed up parsing of target lists in for loops. This was previously limited
to fairly simple target lists.
#for ($i, $j) in [('aa','bb'),('cc','dd')]
$i.upper,$j.upper
#end for"
#for (i, j) in [('aa','bb'),('cc','dd')]
$i.upper,$j.upper
#end for"
#for i,(j, k) in enumerate([('aa','bb'),('cc','dd')])
$j.upper,$k.upper
#end for"
- refactored the class initialization process
- improved handling of target lists in #set directive. This was previously
limited to fairly simple target lists.
#set i,j = [1,2] ... #set $i,$j = [1,2]
#set (i,j) = [1,2] ... #set ($i,$j) = [1,2]
#set i, (j,k) = [1,(2,3)] ... #set $i, ($j,$k) = [1,(2,3)]
- made it possible for the expressionFilter hooks to modify the code chunks
they are fed. Also documented the hooks in a docstring. Thus the hooks
can be used as preprocessors for expressions, 'restricted execution', or
even enforcement of style guidelines.
- removed cheetah junk from docstrings and placed it all in comments or
__moduleVars__. Per JJ's suggestion.
- made it possible to nest #cache directives to any level
- made it possible to nest #call directives to any level
Unit Tests [TR]
- extended tests for #for directive
- expanded tests for #set directive
- expanded tests for #call directive
- expanded tests for #cache directive
- added basic tests for the new $placeholder string expressions:
c'text $placeholder text'
2.0b3 (Jan 5, 2006)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes: [TR]
- added #yield statement
- added ability to create nested scopes/functions via nested #def statements
- added new #call directive and related #arg directive, per Ian Bicking's
suggestion.
- added new expression syntax c"text $placeholder text"
for those basic function calling cases where you just need to pass in a
small bit of cheetah output as an argument:
c'a string with $placeholders',
c'''a string with $placeholders''',
c"a string with $placeholders",
c"""a string with $placeholders"""
- They can't contain #directives, but accept any valid $placeholder syntax
except caching placeholders. Caching placeholders don't make any sense in
this context.
- They can be used *any* place where a python expression is expected.
- They can be nested to any depth.
$func(c'
$var1-$var2')
$func(c'$var1-$var2', doSomething=True)
$func(content=c'$var1-$var2', doSomething=True)
$func(lambda x,y: c'$x-$y')
$func(callback=lambda x,y: c'$x-$y')
$func(lambda x,y: c'$x-$y-$varInSearchList')
$func(c'$var1-$var2-$(var3*10)-$(94.3*58)')
$func(c'$var1-$var2-$func2(c"a nested expr $var99")')
#if $cond then c'$var1-$var2' else c'$var1-$var2
'
#def foo(arg1=c'$var1$var2'): blah $arg1 blah
$foo(c'$var1$var2')
- added preprocessor hooks to Template.compile()
can be used for partial completion or 'compile-time-caching'
... more details and examples coming. It's very useful, but takes a bit
of explaining.
- added '#set module varName = expr' for adding module globals. JJ's suggestion
- improved generated docstring notes about cached vars
- fixed silly bug related to """ in docstring comments and statements like
this '#def foo: $str("""foo""")'. Reported by JJ.
- changed the handling of single-line defs so that
'#def xxx:\n' will be treated as a multi-line #def.
The same applies to #block. There's a compiler setting to turn this off
if you really need empty single-line #def:'s.
JJ reported that this was causing great confusion with beginners.
- improved error message for unclosed directives, per Mike Orr's suggestion.
- added optional support for passing the trans arg to methods via **KWS rather
than trans=None. See the discussion on the mailing list Jan 4th (JJ's post) for
details. The purpose is to avoid a positional argument clash that
apparently is very confusing for beginners.
Note that any existing client code that passing the trans arg in
positionally rather than as a keyword will break as a result. WebKit
does this with the .respond method so I've kept the old style there.
You can also turn this new behaviour off by either manually including
the trans arg in your method signature (see the example below) or by
using the compiler setting 'useKWsDictArgForPassingTrans'=False.
#def manualOverride(arg1, trans=None)
foo $arg1
#end def
ImportHooks:
- made the ImportHook more robust against compilation errors during import [TR]
Install scripts: [TR]
- added optional support for pje's setuptools
- added cheeseshop classifiers
- removed out of date install instructions in __init__.py
Servlet Base Class For Webkit: [TR]
- disabled assignment of self.application (was a webware hack)
Unit Tests: [TR]
- unit tests for most of the new syntax elements
- tidied up some old tests
- misc refactoring
2.0b2 (Dec 30, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes:
- In previous versions of Cheetah tracebacks from exceptions that were raised
inside dynamically compiled Cheetah templates were opaque because
Python didn't have access to a python source file to use in the traceback:
File "/usr/local/unsnarl/lib/python/us/ui/views/WikiPageRenderer.py", line 192, in getTextiledContent
content = str(template(searchList=searchList))
File "cheetah_DynamicallyCompiledCheetahTemplate_2005123013020776922.py", line 202, in __str__
File "cheetah_DynamicallyCompiledCheetahTemplate_2005123013020776922.py", line 187, in respond
File "cheetah_DynamicallyCompiledCheetahTemplate_2005123013020788104.py", line 139, in writeBody
ZeroDivisionError: integer division or modulo by zero
It is now possible to keep the generated source code from the python
classes returned by Template.compile() in a cache dir. Having these files
around allows Python to include the actual source lines in tracebacks and
makes them much easier to understand:
File "/usr/local/unsnarl/lib/python/us/ui/views/WikiPageRenderer.py", line 192, in getTextiledContent
content = str(template(searchList=searchList))
File "/tmp/tmp9OVLwe/cheetah_2005123012172480269.py", line 202, in __str__
def __str__(self): return self.respond()
File "/tmp/tmp9OVLwe/cheetah_2005123012172480269.py", line 187, in respond
self.writeBody(trans=trans)
File "/tmp/tmp9OVLwe/cheetah_2005123012172449990.py", line 139, in writeBody
__v = 0/0 # $(0/0)
ZeroDivisionError: integer division or modulo by zero
This is turned off by default. To turn it on, do this:
class NiceTracebackTemplate(Template):
_keepGeneratedPythonModulesForTracebacks = True
_cacheDirForGeneratedPythonModules = 'xxxx' # change to a dirname
templateClass = NiceTracebackTemplate.compile(src)
This only works with the new Template.compile(src) usage style!
Note, Cheetah generated modules that are compiled on the command line have
never been affected by this issue. [TR]
- added an extra comment per $placeholder to generated python code so it is
easier to grok. [TR]
2.0b1 (Dec 29, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Core Changes:
- enabled use of any expression in ${placeholders}. See the examples I posted to
the email list on Dec 12th. All use cases of the #echo directive can now
be handled with ${placeholders}. This came from a suggestion by Mike
Orr. [TR]
- made it possible for templates to #extend (aka subclass) any arbitrary
baseclass, including Python's new style classes. You must either compile
your classes on the command line or use the new classmethod
Template.compile() as described below. The old Template(src) interface
still works, provided you don't try to use this new arbitrary baseclass
stuff. See my messages to the email list for more details. [TR]
- made it possible to create template classes dynamically, rather than just
instances. See the new classmethod Template.compile(). See my messages
to the email list for more details. [TR]
klass = Template.compile(src)
- made it easier to work with custom compiler settings, particularly from
the command line tool. You can now define a subclass of Template which
will compile your templates using custom compilerSettings, or even a
custom compiler class, without requiring you to manually pass in your
compilerSettings each time or define them in the template src itself via
the #compiler directive. You can make the command line tool use your
subclass by defining the environment variable CHEETAH_TEMPLATE_CLASS. It
should be in the form 'package.module:class'. See my messages
to the email list for more details. [TR]
- made it possible to pass the searchList in as an argument to #def'ined
methods. This makes all lookup that occur within the scope of that method
use the provided searchList rather than self._searchList. This does not
carry over to other methods called within the top method, unless they
explicitly accept the searchList in their signature AND you pass it to
them when calling them. This behaviour can be turned off with the
corresponding compilerSetting 'allowSearchListAsMethArg' [TR]
- added hooks for filtering / restricting dangerous stuff in cheetah source
code at compile time. These hooks can be used to enable Cheetah template
authoring by untrusted users. See my messages to the email list for more
details. Note, it filters expressions at parse/compile time, unlike Python's
old rexec module which restricted the Python environment at runtime. [TR]
# Here are the relevant compiler settings:
# use lower case keys here!!
'disabledDirectives':[], # list of directive keys, without the start token
'enabledDirectives':[], # list of directive keys, without the start token
'disabledDirectiveHooks':[], # callable(parser, directiveKey),
# called when a disabled directive is found, prior to raising an exception
'preparseDirectiveHooks':[], # callable(parser, directiveKey)
'postparseDirectiveHooks':[], # callable(parser, directiveKey)
'preparsePlaceholderHooks':[], # callable(parser)
'postparsePlaceholderHooks':[], # callable(parser)
'expressionFilterHooks':[],
# callable(parser, expr, exprType, rawExpr=None, startPos=None)
# exprType is the name of the directive, 'psp', or 'placeholder'.
#all lowercase
- added support for a short EOLSlurpToken to supplement the #slurp
directive. It's currently re.compile('#\s*\n') (i.e # followed by
arbitrary whitespace and a new line), but this is not set in stone. One
other suggestion was the backslash char, but I believe Python's own
interpretation of backslashes will lead to confusion. The compiler
setting 'EOLSlurpToken' controls this. You can turn it off completely by
setting 'EOLSlurpToken' to None. See the email list for more details. [TR]
- added '_CHEETAH_' prefix to all instance attribute names in compiled
templates. This is related to the arbitrary baseclass change. [TR]
- shifted instance attribute setup to _initCheetahAttributes() method. This
is related to the arbitrary baseclass change. [TR]
- made it possible to use full expressions in the #extends directive, rather
than just dotted names. This allows you to do things like this:
#from xx.TemplateRepository import getTemplateClass
#extends getTemplateClass('someName')
I don't expect this to be used much. I needed it for a wiki system in
which the baseclasses for the templates are dynamically compiled at run
time and are not available via simple imports. [TR]
- added compiler setting autoImportForExtendDirective=True, so this existing
default behaviour can be turned off when needed. [TR]
- fixed a bug in the parsing of single-line #def's and #block's when they
are enclosed within #if ... #end if. Reported by Marcin Gajda [TR]
- tweak to remove needless write('') calls in generated code [TR]
The command line tool (CheetahWrapper.py):
- added code to cleanup trailing slashes on path arguments (code originally
from Mike Orr) [TR]
- turned on the ImportHooks by default for the 'cheetah fill' command. See the
discussion on the email list [TR]
ImportHooks:
- fixed a name error bug in the ImportHooks [TR]
1.0 (Dec 4, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
Version bump from 1.0rc3
1.0rc3 (Nov 30, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
- added useSearchList compiler setting [TR]
This defaults to True, but if false, the compiler assumes the first
portion of a $variable (before the first dot) is a global, builtin, or local
var that doesn't need looking up in the searchlist. NameMapper's unified
dotted notation will still be used on the rest of the lookup (provide the
setting useNameMapper==True):
$aLocalDictVar.aKey.somethingElse
1.0rc2 (Nov 19, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
See my email to the cheetahtemplate-discuss list on Sat. Nov. 12th for more
details on these changes:
- faster list-based buffering in DummyTrans, rather than StringIO (my
benchmarks showed it to be significantly faster. collections.deque wasn't
any faster than a simple list.) [TR]
- new CompilerSettings to tweak generated code: [TR]
* alwaysFilterNone: filter out None immediately, before the filter is called
* useFilters: allows you to turn them off completely and default to str()
* includeRawExprInFilterArgs: allows you to disable this behaviour
* autoAssignDummyTransactionToSelf: off by default
- and automatic $trans finding without having to pass it as an arg to methods
based Jonathan Mark's suggestion. If the template's self.transaction
attribute has been set, each method of the template will use it when
called. [TR]
- applied Chris Murphy's patch to fix a bug in the #shBang directive. [TR]
1.0rc1 (Nov 2, 2005)
!!!THIS RELEASE REQUIRES RECOMPILATION OF ALL COMPILED CHEETAH TEMPLATES!!!
- added the compiler option "useStackFrames" for optionally turning off the
default lookup method which doesn't work with psyco because it uses stack
frame introspection. When useStackFrames=False, an alternative psyco
friendly lookup method is used. [TR]
- fixed treatment of None in several filters, bug reported by Daniele Varrazzo
[TR]
0.9.18 (Aug 22, 2005)
- version bump from 0.9.18rc1 [TR]
0.9.18rc1 (Aug 15, 2005)
- applied Philippe Normand's patch for extended cache support [TR]
- added filter RawOrEncodedUnicode to fix a unicode issue that was discussed
on the email list on Aug. 9th 2005 [TR]
0.9.17 (May 30, 2005)
- this is just 0.9.17rc1 repackaged [TR]
0.9.17-rc1 (May 12, 2005)
This simple bug fix release resolves some issues introduced by
under-the-hood changes in release 0.9.16a1.
- removed the use of temp files for handling imports with dynamic
compilation. This removes a whole slew of issues, including a temp file
security issue reported on the email list by Brian Bird. [TR]
- fixed bug with handling of the searchList with dynamic inheritance, as
reported by Brian Bird. [TR]
0.9.16 (Mar 27, 2005)
- this is just 0.9.16b1 repackaged [TR]
0.9.16b1 (Feb 28, 2005)
- fixed attr error in Parser.eatEncoding [TR]
- some tweaks to Compiler.py to prevent errors with dynamically compiled
templates [TR]
- added tests for the #encoding directive [TR]
0.9.16a1 (Jan 6, 2005)
- fixed a unicode bug in Compiler.py [TR]
- added new EncodeUnicode filter that Rene Pijlman contributed (I optimized it
slightly) and made it the default filter for all templates. [TR]
- added test cases for handling unicode with the default filter [TR]
- fixed a caching bug related to the #include directive. Thanks to Michael
Engelhart for reporting it.[TR]
- added the new #encoding directive to handle PEP 263
http://www.python.org/doc/2.3/whatsnew/section-encodings.html [TR]
- Tools.CGITemplate: fix bug in comment.[MO]
- Abort with a helpful error message if user runs 'cheetah test' in a
directory without write permission. (Kludge in CheetahWrapper.py; we
should probably move the temp files under the system tmp directory.) [MO]
- added better string type checking for args in Template.py, as suggested by
Terrel Shumway [TR]
- minor tweak to the class attribute lookup style in the Compiler.py
__getattr__ methods [TR]
- Fix printf format bug in "cheetah c --debug", found by Terry MacDonald. [MO]
- Disabled NameMapperDict test (in SyntaxAndOutput.py) because the
namemappers still have the dict-method bug. (Reminder: don't use
placehold names like $update that match dict method names.) [MO]
- #repeat now uses a local variable of the form __i$num which permits
nesting [JJ]
- implemented a modified version of Bob and JJ's patch for better parser
warnings about mismatched directives and #end directives [TR]
- lots of little cleanups and refactoring [TR]
- refactored the class tree for the Parser and Compiler. They are now
completely separate trees and the communication between them is one-way:
explicit commands from the parser to the compiler. The parser now handles
all parsing tasks by itself and delegates *all* code generation to the
compiler. This last bit was my original intention, but things got a bit
mixed up over time. Also, all SettingsManager stuff for handling
compiler/parser settings is now handled by ModuleCompiler. This should make
it easier to grok, maintain, and extend both. [TR]
- improved the parsing of singe-line #if directives. [TR]
- removed the old webware example of the cheetah site, as it was way out of
date and was more confusing than helpful. [TR]
- added two new lookup functions to NameMapper (valueFromFrame and
valueFromFrameOrSearchList) and synchronized the behaviour of the C and
Python versions of all functions. [TR]
- improved the exception handling of both versions of NameMapper. NotFound
exceptions now include more detail about what wasn't found. [TR]
- made NameMapper's searchList lookup functions work with any iterable
type/class rather than just with lists. [TR]
- added and updated a variety of test cases. [TR]
- checked in a patch to CheetahWrapper that improves handling of the odir
option when the path is absolute. I can't remember where the patch came
from. [TR]
- checked in a patch to Template.py for better include/import support under
Jython. Again, I've forgotten who contributed it. [TR]
- updated various bits of the user guide. [TR]
- made the Cheetah NameMapper calls in the generated code use the new function
valueFromFrameOrSearchList rather than passing locals, searchList, globals,
and __builtins__ into valueFromSearchList. This is faster, less bug prone
and simpler to read/grok. I also removed all tracking of local
variable names by the compiler. [TR]
- other misc. refactorings [TR]
0.9.15 (Mar 25, 2003)
- a minor tweak to the cleanup actions of one of the test cases [TR]
0.9.15rc2 (Mar 23, 2003)
- Fixed a python version dependency bug related to Compiler.py's use of
isinstance() [TR]
0.9.15rc1 (Mar 21, 2003)
This is just 0.9.15b1 renamed.
0.9.15b1 (Mar 17, 2003)
- The Cheetah version of unittest now prints a blank line after each
traceback to separate them. (MO)
- .webInput() now saves the cgi.FieldStorage() instance in a global
variable rather than recreating it each call. That should allow the
method to be called multiple times with POST variables outside Webware.
(MO)
- CheetahWrapper: no verbose output on stdout with --stdout/-p. (MO)
- "#indent" is now undocumented. The existing code remains intact for now.
See the TODO file for our future plans. (MO)
- Apply 2 unicode-support patches from Rodrigo B. de Oliveira (rodrigobamboo)
that affected the Template and ModuleCompiler classes. (TR)
- Template: compiling a template from a string now works if the current
directory doesn't have write permission. (MO)
- remove temporary .pyo files in addition to .py and .pyc files (TR)
0.9.15a3 (Nov 10, 2002)
- corrected a dictionary bug in the Python version of NameMapper (TR)
- Rewrote the "cheetah" command (CheetahWrapper.py) again and added test
cases. New options --flat and --nobackup; --stdout is now a synonym for
-p. See the "cheetah compile" section in the Users' Guide for details.
Deleted Utils.dualglob: merged into CheetahWrapper. (MO)
- .addToSearchList() and .prependToSearchList() are gone. Instead of
adding containers to the searchList after instantiation, pass all the
containers you need to the constuctor, keep another reference somewhere
to the containers, and modify the containers directly. Generic libraries
that want to add a new kind of information to the searchList (e.g.,
web variables) should do "self.searchList().insert(0, myContainer)". (MO)
0.9.15a2 (Nov 4th, 2002)
- Filters now have access to the name of the placeholder they're filtering.
In the .filter() method, kw['rawExpr'] gives the entire placeholder name
including subscripts and arguments, exactly as it appears in the template
definition. (TR)
- Fix three bugs in "cheetah compile -R": (1) the generated class name
contained the subdirectory, (2) the destination path did not contain the
subdirectory, (3) Cheetah failed to create the destination subdirectory
if missing. All subdirectories created have an "__init__.py" file.
"cheetah fill -R" does the same thing but does not create
"__init__.py". (MO) NOTE: this is still buggy!
- New directory "attic" in source contains code that has been abandoned
for now but may come in handy someday. (MO)
- Tests.CheetahWrapper: test suite for "cheetah compile" and
"cheetah fill". If the module is run from the command line, the
option "--list PATH/CheetahWrapper.py", lists all scenarios that would be
tested; the argument is the path to the test module itself. (MO)
- made Cheetah.NameMapper.NotFound subclass the builtin LookupError (TR)
- added an initial implementation of single line #if directives
#if then else
The parsing is fairly rudimentary for now and assumes that the keywords
'then' and 'else' won't appear any inside a string in this directive (TR)
0.9.15a1 (Oct 6th, 2002)
- fixed a package-relative import bug in ImportHooks.py (TR)
- set 'monitorSrcFile' to false as it was causing problems with the
ImportHooks ... This might be temporary as the problem needs more thought
(TR)
- fixed meta tag http_equiv to be http-equiv in SkeletonPage (TR)
- $webInput (Utils.WebInputMixin) 'source' arg can be either case. (MO)
- fixed code-gen bug in MethodCompiler.commitStrConst that was leading to
triple single quotes followed immediately by another single quote if the
template def contained a '$placeholder' surrounded in single quotes and
multiple \n newlines ... plus added new test case.(TR)
- undocumented the '#settings' directive. The directive itself will be
removed soon. (MO)
- Utils.optik: Optik 1.3 package by Gregory P Ward, for parsing
command-line options in 'cheetah' comamnd. Copied unchanged into
Cheetah except added "Cheetah.Utils.optik." prefix to intra-package
imports. Optik's copyright and license is in an appendix in the
Cheetah Users' Guide. (MO)
- rewrite of the "cheetah" and "cheetah-compile" commands.
The command-line options have changed! Removed CheetahCompile module
removed and its test suite too; CheetahWrapper now takes its place. (MO)
- Utils.dualglob: new module to recursively generate source+destination
filenames from command-line filespecs. (MO)
- The command-line options of .py template modules have also changed
to conform with the "cheetah" command. Also a --pickle bug was
fixed. (MO)
- Utils.WebMixin: made a string type comparision backward compatible.
This was why the Cheetah test suite was failing on Python < 2.2! (MO)
- SettingsManager._createConfigFile(): bugfix in default argument. (MO)
- $hasVar('varName') is an alias for $varExists('varName'). (MO)
- $_fileDirName and $_filePath are now None rather than missing if
the template definition did not come from a named file. (MO)
- applied patch on SourceForge for "%" in default arguments of a block (TR)
- removed the _underscored attribute lookup step from NameMapper NOTE THIS
MIGHT BREAK EXISTING TEMPLATES (TR)
- Install Cheetah into site-packages/Cheetah/ rather than
site-packages/Webware/Cheetah/. Added code to automatically remove the old
dir.(TR)
- fixed the variable name resolution order bug in $placeholders. The new
implementation uses
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)
- I think I've fixed the problem with the searchList arg being discarded when a
template is generated from a .tmpl file that #extends another template. This
bug was reported by Edmund on Aug 30th
(subject: "Bug? Was: Really basic searchList question") (TR)
0.9.14 (July 14, 2002)
- Precompiled template Templates/SkeletonPage.py added to CVS. This file is
needed for Cheetah's regression tests. (MO)
- removed automatic recompilation of .py template in memory if the
.tmpl file has changed. (TR)
0.9.14b1 (June 30, 2002)
- moved the Users' Guide and the Developers' Guide into a separate CVS module,
'CheetahDocs', so they can be distributed separately from the source distro
(TR,MO)
- added TypeType to the types that NameMapper won't do autocalling on (TR)
- in Template.py moved the global LegalKWs to Template._legalKWs (TR)
- made #set work with RVALUES that are missing the recommended $ (TR)
- added some new test cases for the #set directive (TR)
- fixed bug in the output of the #unless directive that Mike found (TR)
- added some module constants to clear up a missing name bug that Mike found
in cases where you use **KW in a Cheetah method definition (TR)
- fixed a bug in Parser.py:_LowLevelSemanticsParser.getExpression() that was
related to the default enclosures=[] argument. This arg was unintentionally
being shared between calls and thus leading to parsing errors as reported by
Greg Czajkowski (TR)
- Filter: fixed an '== None' expression (should be 'is None'). (MO)
- TemplateMisc: new base class for Template. This is for optional
convenience methods that don't require Webware. (MO)
- User's Guide: new sections "Non-Webware HTML Output" and "Non-HTML
Output". (MO)
- Expanded $webInput() -- renamed from $cgiImport() -- to work both with
Webware input and CGI scripts. Handles GET/POST/cookie/session vars under
Webware, and GET/POST under CGI. Defined in Cheetah.Utils.WebInputMixin,
now inherited by Template directly. (MO)
- Tools.CGITemplate has methods to output CGI headers: .isCgi, .cgiHeaders
and .cgiHeadersHook in TemplateMisc. (MO)
- New #indent directive allows you to indent block constructs in the
template definition without having that indentation in the output, and
allows you to set the output indentation per line independent of the
indentation in the template definition. This version uses Robert
Kuzelj's #indent syntax exactly. In the next few days,
Cheetah.Utils.Indenter will be refactored and
*** THE #INDENT SYNTAX WILL CHANGE! *** (MO)
- added the #return directive as requested by Robert Kulezj (TR)
- added some test cases for the #return directive (TR)
- removed buggy import statement that had been left in Servlet.py after the
CGIInputMixin changes (TR)
0.9.13 (May 8, 2002)
- changed Cheetah.Servlet.isRunningFromWebKit to isWebwareInstalled (TR)
- fixed parsing bug that would exit an expression if the directiveEndToken was a
valid Python token and was found inside the directive. (TR)
E.g.:
#compiler-settings
directiveStartToken = .
directiveEndToken = :
commentStartToken = #
#end compiler-settings
.for a in [1,2,3,4][2:3]:
blag
.end for
- fixed #include bug that was resulting in non-unique includeIDs (TR)
0.9.13b2 (May 3, 2002)
- fixed the bug in Cheetah.Servlet.Servlet.serverSidePath that Jeff Johnson
found. (TR)
- changed the attribute Cheetah.Servlet.ServletisRunningFromWebKit to
isControlledByWebKit and set the default to False unless the .awake method
is called. This makes a clear distinction between templates that are being
used with WebKit via the inheritance approach and the containment approach
(TR)
0.9.13b1 (May 1, 2002)
- Was going to import cStringIO instead of StringIO, but it made the
DummyTransaction.py unittest fail so I undid it. Cheetah aims to provide
Unicode support, which cStringIO does not provide. (TR/MO)
- Utils.Misc.CheckKeywords(): prevent misspelled keyword arguments,
used by Template constructor. (MO)
- removed support for multiple inheritance (TR)
- added some bounds-checking code to _namemapper.c's getNameChunks function
(TR)
- changed the exceptions in _namemapper.c from the old string exceptions
to proper exception objects (TR)
- first portion of Developers' Guide written (MO)
- implemented the extended #extends directive, which does automatic importing
(MO,TR)
- added some new testcases for the extended #extends directive (TR)
- lots of work on the Users' Guide (MO)
- implemented and tested an import hook for .tmpl files (TR):
import MyTemplate # will compile and import MyTemplate.tmpl
- made my True/False declarations friendly with Python 2.2.1, which already
includes True/False as builtins (TR)
- implemented the #compiler directive that Edmund Lian suggested (TR)
e.g.:
#compiler commentStartToken = '//'
// a comment
#compiler reset
// no longer a comment
- fixed the bug that Edmund Lian found in .addSet() when useNameMapper = 0
(TR)
- fixed bug in comment creation using lineCol that Mike found (TR)
0.9.12 (April 3, 2002)
- no code changes from beta 2
- more work on the docs (MO)
0.9.12b2 (Mar 28, 2002)
- fixed Win32 path bug in Template._makeDummyPackageForDir() (TR)
- prettied up the format of the debug comments in the Cheetah generated
Python code (TR)
- fixed the non-unique key error in Template._includeCheetahSource (TR)
- fixed the module import bug in 'cheetah compile -w' (TR)
0.9.12b1 (Mar 24, 2002)
- $request().field(args) now works, identical to $request.field(args)
to implement this, the request object is now self.request() instead of
self.request. This provides compatibility with Webware's servlet API.
(self.session already was an accessor method). New read-only attribute
self.isRunningFromWebKit is boolean. All changes are in Servlet.py. (MO)
- fixed nested-NotFound bug in _namemapper.c's valueFromSearchList (TR)
- 'cheetah' wrapper script has abbreviation -c for the 'compile' command,
-t for 'test', and an ASCII-art cheetah face in the help message. (MO)
- CheetahCompile.py: fixed to recognize --help option and to show --help/-h
in help message. (MO)
- CheetahCompile.py:
changed the order of the VERBOSE mode printouts, as per Mike's request (TR)
- Template.py:
fixed the #include'd template searchList sharing problem, as reported by
Johannes (TR)
- corrected namemapper translation bug in
Compiler.GenUtils.genNameMapperVar() (TR)
- Utils.Misc.UseOrRaise(): convenience function to return a
value, or raise it if it's a subclass of Exception. (MO)
- Utils.CGIImportMixin replaces Tools.WebwareMixin. Servlet now
subclasses it. This adds the .cgiImport() method to all servlets, allowing
sophisticated retrieval of form fields, cookies or session variables from
one line of Cheetah or Python code. See module docstring. (MO)
- lots of updates to the docs (MO)
0.9.11 (Mar 07, 2002)
- fixed a careless bug in cheetah-compile (TR)
- implemented the new 'cheetah' wrapper script (TR)
- refactored the local copy of unittest a bit (TR)
0.9.10 (Mar 06, 2002): Primarily a bug fix release
- fixed bug in srcfile-mtime monitoring / update code (TR)
- fixed the parsing of single-line #defs and #blocks so they can have
arguments (TR)
- added test cases for single-line #defs and #blocks with args (TR)
- fixed a silly typo bug in Parser.py where a comma was left at the end of
regex definition, make it a tuple rather than a regex
- fixed the directive matching bug that Jeff Johnson reported. It was
causing #else# to not match, while #else # was matching. + added a test
for it.(TR)
- fixed bug in a regex that was preventing bare $'s followed by whitespace
and then valid varname chars from parsing as just $ instead of as a
placeholder (TR)
- added some code to break reference cycles after the compilation is
complete. This helps prevent memory leaks when a process in creating then
discarding lots of Templates. You also need to manually call
"template.shutdown()" to clear the remaining reference cycles.
(TR)
- fixed string formating bug in the autogenerated docstring code (TR)
- added better error message for the #attr directive (TR)
- removed some residual code that was causing a bug with cheetahvars that
started with the name of one of the imported modules, such as 'time'. (TR)
0.9.9 (Dec 14, 2001)
- implemented one-line #def's and #block's (TR)
#def aTest: This is a $adj test ---- READ THE MANUAL FOR MORE INFO.
NOTE: leading and trailing whitespace is stripped. These should only be
used on lines by themselves as it reads to the end of the line.
- made cheetah-compile accept input on standard input (TR)
- made sure that #def and #block work with $'s on the method names (TR)
0.9.9b1 (Dec 6, 2001)
- template constructor arg 'outputFilter' now 'filter', for consistency
with #filter (MO)
- template constructor raises TypeError if bad arguments (MO)
- Cheetah.Utils.VerifyType new module containing functions for verifying the
type of an argument (MO)
- Cheetah.Utils: new package for non-Cheetah-specific modules needed by
Cheetah (MO)
- Cheetah.Filters: new filter WebSafe, several bugfixes (MO)
- more work on the Users' Guide (MO)
- fixed bug with adding Python's __builtins__ to the local vars list (TR)
- fixed bug with #echo (TR)
- fixed bug that was preventing ${a, $b=1234} from working like ${a, b=1234} (TR)
- fixed some bugs in Template.varExists and Template.getVar()
(TR - thanks to MH for spotting them)
- made it possible to use filenames like 'spam-eggs.txt' that have invalid
characters for module names with Template(): Template(file='spam-eggs.txt')
(TR/MH)
- refactored 'cheetah-compile' a little (TR)
- Cheetah.Filters.Strip: new filter to strip leading/trailing whitespace
but preserve newlines. Suitable for #filter directive or (possible)
future #sed directive. (MO)
- Cheetah.Filters.StripSqueeze: new filter to canonicalize all whitespace
chunks to ' '. Also removes all newlines (joining multi-line input into
one long line), and leading/trailing whitespace from the final result. (MO)
- Filters can now be used standalone for debugging or for use outside
Cheetah. This works transparently; details are in Filters.py docstring.
(MO)
- Cheetah.Tools.MondoReport: new module for dividing a long list into
"pages", and for calculating statistics useful in reports. (MO)
- refactored Cheetah.Servlet.Servlet.Awake a little (TR)
- fixed an output bug in the #block generated code that turned up when you
tried to override a block method from Python rather than Cheetah. (TR)
- started preparing to shift some of the 'shared' utility classes, such as
SettingsManager, to the Webware core. Cheetah 1.0 will probably require
Webware to be installed so it can access those shared classes. (TR)
- extended the template module command line interface(TR/MO)
0.9.9a6 (Nov 6, 2001)
- fixed bug with quotations in longer constant string chunks (TR)
- fixed another bug in the cheetah-compile script (TR)
- fixed a bug in the file-update monitoring code that was resulting in
infinite loops when used with Template sub-classes (TR)
- extended the #filter framework according to Mike's suggestions (TR)
- added test modules for cheetah-compile and the file-update monitoring code (TR)
- extended the capabilities of cheetah-compile ... (IB)
- updated the docs (MO)
0.9.9a5 (October 31, 2001)
- fixed a bug I created yesterday (TR)
0.9.9a4 (October 30, 2001)
- added #repeat (TR implementing Chuck's suggestion)
- added #unless (TR implementing Mike's suggestion)
- updates to the Users' Guide (MO)
- fixed a small bug in the cheetah-compile script, as reported by Ian on the
list (TR)
0.9.9a3 (October 12, 2001)
- more in the Users Guide (TR)
- renamed #attribute as #attr (TR)
- renamed #call as #silent (TR)
- added #echo directive (TR)
0.9.9a2 (October 11, 2001)
- updated the example site and the SkeletonPage framework (TR)
- fixed some small bugs (TR)
- corrected some typos in the docs (TR + MO)
- added Ian's sitehiearchy class to Cheetah.Tools (TR + IB)
0.9.9a1 (October 9, 2001) [many changes and bug-fixes]
- a complete reimplementation of Cheetah's core (the parser and compiler
classes) (TR + IB)
- implemented the #def, #implements, #import, and #from directives
+ removed #redefine and #macros
+ renamed #extend as #extends (TR + IB)
- replaced #data with #settings, see the docs (TR)
- restructured and updated the docs (TR + MO + IB)
- reimplemented the cheetah-compile script, without the -g option that Ian
had added (TR)
- changed the signature of Template.__init__. See the docs. (TR)
- made #set distinguish between local and global vars. See the docs. (TR)
- added hundreds of new test cases (TR)
- added the #breakpoint and #compiler-settings directives (TR)
- started restructuring the SkeletonPage framework [not complete yet] (TR)
- started restructuring the example sites [not complete yet] (TR)
0.9.8 (October 9, 2001)
- added a few new language constructs (aka 'directives') to Cheetah (TR)
#while ... #end while
#try ... #except ... #else ... #finally ... #end try
- fixed a bug in the handling of local vars in #for loops that was preventing
callable local vars from being handled properly. See Chuck's post of Sept
10. (TR)
- fixed a pointer bug in the C version of NameMapper.valueFromSearchList()
that was yielding undefined values for the NotFound exception when it was
raised (TR)
- prefaced all internal args to Template() with underscores (TR)
- fixed the problem with parsing triple quoted strings in arg lists (TR)
- updated the docs (TR)
0.9.8a4 (September 7, 2001)
- Added -g (appendGen function argument), which compiles x.tmpl to xGen.py,
with x.py being for non-generated Python code. Also changed option handling
a little and added a comment to the top of compiled files. (IB + MO)
- finalized the #include syntax after a lengthy discussion on the list
This is different from in 0.9.8a3 (TR)
#include
... uses the value of EXPR as the path of the file to include.
#include source =
... includes the value of the EXPR
where is 'raw' or ''
- re-implemented the output mechanism to use streaming via Webware's
Transaction and Response objects when available and fake it with the
DummyTransaction DummyResponse classes when the Webware Transaction is not
avialable. This behaviour is roughly the same as in Webware's PSP. Will
implement output buffering PHP-style later if there is any demand. (TR)
- made #include a run-time directive rather than compile-time. This is
slower, but the semantics are better. (TR)
- various small optimizations to the generated code (TR)
- updated the docs (TR)
0.9.8a3 (August 22, 2001) [includes changes for 0.9.8a1 and 0.9.8a2]
- Added package ./src/Tools/ for contributed classes/functions/packages not
necessary to run Cheetah. The first such class is RecursiveNull.py by Ian
Bicking. Added package Cheetah.Tools to list in ./setup.py . (MO)
- Template.__init__ keyword arg 'searchList': no longer has to be a tuple. It
may be a list or any type that that Python's 'tuple' function accepts. (MO)
- Template.__init__ new keyword arg 'file': this may be a filename or file
object to read the Template Definition from. If you use this, you must not
pass a Template Definition string also. New instance variables
._fileName and ._fileMtime are set if a filename was passed; otherwise they
are None. (MO)
- CodeGenerator new function 'varNotFound_KeyError': raises KeyError if a
placeholder name is missing when filling the template. Disabled by default.
(MO) NB - this change has been superceeded by 'errorCheckers'
- Template.getUnknowns (new method): returns a list of Placeholder Names
missing in the Search List. (MO) - this change has been superceeded by
'errorCheckers'
- made changes to Template.py, CodeGenerator.py, PlaceholderProcessor.py,
and TagProcessor.py to enable customization of the placeholderStartToken so
it can be set to any character sequence, rather than just the default '$'.
This is configurable by the Template setting 'placeholderStartToken' (TR)
- fixed a small bug in PlaceholderProcessor.processTag() that prevented
static caching (i.e. $*) of a value containing ''' style quotes
- added #break and #continue (TR)
- fixed the relative path problem with #include when using Cheetah with WebKit
(TR)
- implemented the #stop directive (TR)
- fixed a bug in the macro processing that prevented macros defined inside
#includes from being visible at the top level (TR)
- fixed a bug in the handling of the setting 'useAutocalling' (TR)
- fixed some bugs in the handling of macros (TR)
- completed the transition to nested template #includes (TR)
- added direct #includes (TR)
- completed the transition to run-time evaluation (TR)
- renamed the .startServer() method of Template to .compile() (TR)
- renamed the 'delayedStart' setting as 'delayedCompile' (TR)
- added .redefineTemplateBlock as an alias to Template.defineTemplateBlock
(TR)
- got relative path includes working with Webware and Cheetah.Servlet (TR)
- lots of changes in the docs (TR & MO)
- implemented a C version of NameMapper (TR + CE)
- added the 'errorCheckers' framwork (TR)
- added the 'formatters' framework and the #formatter directive
- a major restructuring of the modules and internal API (TR)
- made sure that all the #directives with start and end tags are
implemented in such a way that they won't cause 'maximum recursion' limit
errors if their content block is long. Simple regexes didn't cut it in these
cases. (TR)
- #macro
- multiline comments
- #data
- #block
- #raw
- the parsing of the core tags (the state-dependent ones) after they have been
translated to the internal delimiters
- made a Template.shutdown() method for cleaning up reference cycles before a
template object is deleted. (TR)
- made the parsing and processing of #macros() more robust (TR)
- implemented the file update checking mechanism (TR)
NOTE, the syntax for the #include is now:
#include file =
... uses the value of EXPR as the path of the file to include.
#include
... includes the value of the EXPR
where is 'raw' or 'direct'
0.9.7 (July 13, 2001)
- reimplemented the parsing of $placeholders using the Python tokenize module (TR)
- now translates into Python code instead of going through NameMapper for
each request
- supports arg lists and nested placeholders
- maintained support for autocalling of functions and methods,
will do this serially for $func.otherFunc, etc.
- reimplemented the #include and #raw directives using nested templates for
parsed includes and string attributes of 'Template' to store raw text
The support for file update monitoring of includes is still not implemented (TR)
- moved some stuff from __init__.py into CHANGES and TODO (TR)
- added a new command 'sdist_docs' to setup.py which rebuilds the docs
when making a source distribution (TR)
- changed the name of the ./Cheetah dir to ./src (TR)
- fixed a bug in one of the code filters that was preventing commas from
being used between $placeholders (TR)
- generalized the line ending regex for single-line comments (TR)
- corrected the spelling of 'Delimiters' throughout Cheetah (TR)
- made insertLines in Utilities.py more robust (Chuck)
- added key argument to raising some NotFound exceptions in NameMapper (Chuck)
- fixed strange bug involving missing templateObj parameter
in PlaceholderProcessor.py(Chuck)
- expanded on the docs (Mike)
0.9.6 (June 12, 2001)
- fixed a bug in NameMapper that was preventing 'obj.__class__.__name__' from mapping (TR)
0.9.5 (June 10, 2001)
- implemented the #cache directive - see the mailing list (TR)
- reworked the handling of cached $placeholders and set $var to mean NO_CACHE,
$*var to mean STATIC_CACHE, and $*15*var to mean TIMED_REFRESH_CACHE (TR)
- renamed Template._getValueForName as Template.mapName (TR)
0.9.4 (June 9, 2001)
- created a SettingsManager base class to handle settings for the Template class (TR)
- moved the HTML docs icons into the same dir as the HTML (TR)
0.9.3
- updated the User's Guide Makefile. Builds HTML, PDF, and PS in the ./docs dir now. (TR)
- changed the refs to 'Tavis Rudd' in the docs to 'The Cheetah Development Team' (TR)
- added a few bits to the docs (TR)
- did some internal renaming so 'nameMapperTags' are referred as 'placeholderTags' (TR)
- added the #slurp directive (TR)
0.9.2
- got the PSP plugin working again. It still need test cases. (TR)
0.9.1
- Changed the name of the package to 'Cheetah' from TemplateServer (TR)
- Changed the name of the Server module and its TemplateServer class to 'Template' (TR)
- Changed the name of the 'TScompile' script to 'cheetah-compile' (TR)
- updated the docs (TR)
0.9.0
- changed the names and behaviour of the #parse and #include directives (TR)
see the docs for more. (TR)
- changed #verbatim to #raw (TR)
- fixed a bug in Tests.py that caused an error on the first run. (TR)
- more docs (TR + MO)
! all tests pass with Python 2.1 and 2.0 (TR)
0.8.4
- changed the #directive end tags to #end if instead of #/if and #end (TR)
macro instead of #/macro (TR)
- more work on the User's Guide (TR)
- fixed a bug in TScompile (TR)
0.8.3
- fixed a problem with the regexs that caused $vars and #directives at the (TR)
very beginning of the template string not to match in Python 2.0 (TR)
- removed some Test cases that made invalid assumptions about the order (TR)
of items in dictionaries. (TR)
0.8.2
- finished half of the User's Guide (TR)
- fixed several small bugs (TR)
- added the #comment directive and removed the old <# multiline comment tag #> (TR)
- changed the explicit directive closure to /# from ;# (TR)
0.7.6
- several small bug fixes (TR)
- reimplemented the #block directive to avoid maximum recursion depth errors (TR)
with large blocks. (TR)
- created many new test cases in the regression testing suite (TR)
- added an example site to the examples/ directory (TR)
- started the User's Guide (TR)
0.7.5
- implemented the command-line compiler (TR)
0.7.3-4
- implemented the regression testing suite (TR)
- fixed a number of small bugs (TR)
0.7.2
- implemented the #longMacro directive (TR)
================================================================================
KEY TO INITIALS USED ABOVE:
TR - Tavis Rudd
CE - Chuck Esterbrook
MO - Mike Orr
IB - Ian Bicking
MH - Mike Halle
JJ - Shannon 'JJ' Behrens