summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhierro <hierro>2002-09-12 07:55:36 +0000
committerhierro <hierro>2002-09-12 07:55:36 +0000
commitc79ab09afa75c452cf003fee400b159585fa96f5 (patch)
treec40e218c5371bae353c20905a0d2efd32807fb26
parent29ca4db5b8379a809c1a266877eeabb6e635b152 (diff)
downloadpython-cheetah-c79ab09afa75c452cf003fee400b159585fa96f5.tar.gz
*** empty log message ***
-rw-r--r--BUGS86
-rw-r--r--CHANGES12
-rw-r--r--TODO107
3 files changed, 135 insertions, 70 deletions
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..977038e
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,86 @@
+Known Bugs in Cheetah
+--------------------------
+See the file CHANGES for a list of bugs that have been resolved.
+
+Developers: if a bug was significant and affected a released version of
+Cheetah, be sure to note its fix in the CHANGES file!
+
+
+Compiler forgets commas
+=======================
+Affects Cheetah 0.9.14, CVS and possibly earlier.
+- fix bug in Parser.getDefArgList() that is mucking up lists where the comma has
+ been forgotten:
+
+ > #cache timer='.5m' id='cache1'
+ > This is a cached region. $voom
+ > #end cache
+ >
+ > the error is:
+ >
+ > "/local/opt/Python/lib/python2.2/site-packages/Webware/Cheetah/Compiler.py",
+ > line 102, in genCacheInfoFromArgList
+ > val = self.genTimeInterval(val)
+ > File
+ > "/local/opt/Python/lib/python2.2/site-packages/Webware/Cheetah/Compiler.py",
+ > line 75, in genTimeInterval
+ > interval = float(timeString)*60
+ > ValueError: invalid literal for float(): .5m' id'cache1
+ >
+ >
+ > Running under pdb shows that Parser.getDefArgList() returned:
+ > "30m' id'cache1" .
+
+
+
+
+
+IOError shouldn't be changed to NameMapper.NotFound
+=====================================================================
+Reproducable in CVS 2002-09-11 / Python 2.2 and
+Cheetah 0.9.14 / Python 2.2.1.
+
+I think this behavior is incorrect; it's deceptive. I suspect that it's
+coming from Cheetah, since Python's own getattr() allows the IOError to
+rise up to the top. Perhaps NameMapper has an overly aggressive
+"except:" somewhere.
+- Chuck Esterbrook <ChuckEsterbrook@StockAlerts.com>
+
+I tried adding an empty "raise" after every "except:" in NameMapper.py,
+but was unable to change the NotFound to IOError. Ergo, the change is
+happening somewhere else. Decide whether this behavior is a bug:
+t'ain't necessarily so just because Chuck says it is.
+- Mike Orr <iron@mso.oz.net>
+
+#### BEGIN notFoundErrorDemo.py
+#!/usr/bin/env python
+from Cheetah.Template import Template as T
+
+class obj:
+
+ def __getattr__(self, name):
+ if name.startswith('__') or name.startswith('get_'):
+ raise AttributeError, name
+ meth = getattr(self, 'get_'+name, None)
+ if meth:
+ return meth()
+ else:
+ raise AttributeError, name
+
+ def get_baz(self):
+ raise IOError
+
+ #def baz(self):
+ # raise IOError
+
+x = obj()
+
+if 0:
+ # raises IOError, as expected
+ print getattr(x, 'baz')
+else:
+ # should raise IOError
+ # instead, raises: NameMapper.NotFound: baz
+ t = T('$baz', searchList=[x])
+ print str(t)
+#### END notFoundErrorDemo.py
diff --git a/CHANGES b/CHANGES
index 6ae687c..88c9813 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,14 +14,20 @@ release
template def contained a '$placeholder' surrounded in single quotes and
multiple \n newlines ... plus added new test case.(TR)
- Utils.optik: Optik 1.3 package by Gregory P Ward, for parsing
- command-line options in 'cheetah' comamnd. (MO)
+ 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!
+ 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)
+ 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)
0.9.14 (July 14, 2002)
diff --git a/TODO b/TODO
index 6dff1f6..422e362 100644
--- a/TODO
+++ b/TODO
@@ -1,17 +1,21 @@
Cheetah TODO list
-----------------
-
* If you are working on a task please put your initials at the end of the
description
-
* When a task is completed please remember to note it in the CHANGES file
+* Unresolved bugs are listed in the BUGS file. Resolved bugs are be listed
+ in the CHANGES file if the bug is considered significant enough and it
+ affected a released version of Cheetah.
Goals for 1.0
=========================================================================
- Change #compiler-settings to #compiler
-- Revamp 'cheetah' command-line arguments (see below)
- write a formalized grammar for Cheetah in BNF
+- update User's Guide about changes to SkeletonPage (no more #settings,
+ etc) (TR)
+- decide whether/when to change the way local/global/builtin variables
+ are looked up (see below).
Other TODO Items
@@ -24,7 +28,6 @@ Other TODO Items
something else do a parsed include ('#include parsed', '#include cheetah'?),
so that users get parsing only if they explicitly request it.
-
- implement some better error handling for misformed #for, #if, #try directives,
etc. At the moment these errors are not caught until Python executes the
code.
@@ -34,29 +37,6 @@ Other TODO Items
This is a cached region. $voom
#end cache
-- fix bug in Parser.getDefArgList() that is mucking up lists where the comma has
- been forgotten:
-
- > #cache timer='.5m' id='cache1'
- > This is a cached region. $voom
- > #end cache
- >
- > the error is:
- >
- > "/local/opt/Python/lib/python2.2/site-packages/Webware/Cheetah/Compiler.py",
- > line 102, in genCacheInfoFromArgList
- > val = self.genTimeInterval(val)
- > File
- > "/local/opt/Python/lib/python2.2/site-packages/Webware/Cheetah/Compiler.py",
- > line 75, in genTimeInterval
- > interval = float(timeString)*60
- > ValueError: invalid literal for float(): .5m' id'cache1
- >
- >
- > Running under pdb shows that Parser.getDefArgList() returned:
- > "30m' id'cache1" .
-
-
- Delete whitespace before a comment on the same line. The methods are
Parser.eatComment() and Parser.eatMultiLineComment(). It's already
working if the line contains 'STUFF#slurp ## comment'. Need to make
@@ -92,45 +72,39 @@ Rewrite the caching framework
- Other ideas in Tavis' head.
-
-Cheetah command revamp
-===============================================================================
-- Usage: cheetah COMMAND ARGUMENTS
-- Commands:
- cheetah --help | -h
- cheetah --version
- cheetah compile | c # .tmpl -> .py
- cheetah fill | f # .tmpl -> .html (Not implemented yet)
-
-- Options common to 'compile', 'fill' and 'cgi':
- -i EXT # input file extension (-i '' for no ext)
- -o EXT # output file extension (-o '' for no ext)
- -R # recurse subdirectories
- - # (as input filename) input from stdin
- -p # output to stdout
-
-- Options for 'fill' (and .py template modules):
- --env # Push environment onto searchList.
- --pickle=FILE # Unpickle FILE and push onto searchList.
- # (--pickle=- => unpickle from stdin)
-
-- Remove options:
- cheetah-compile -w # Same as 'cheetah fill' but less powerful.
- cheetah -c # 'cheetah c' is easier to type.
- -p (pickle) # Conflicts with -p (to stdout)
-
-- Input extension, unless overridden by -i, is ".tmpl". If an input file is
- specified but does not exist, try adding this extension. When recursing,
- consider only files with this extension.
-
-- Output extension, unless overridden by -o, is ".py" for 'cheetah compile'
- and 'cheetah cgi', and ".html" for 'cheetah fill'.
-
-- Program will examine its own name ( os.path.basename(sys.argv[0]) ), and if
- it looks like "cheetah-WORD", use WORD as the command instead of sys.argv[1] .
- Then cheetah-compile can be a symlink or copy of this, and people can create
- cheetah-fill etc if desired.
-
+- Have an option to refresh the cache whenever an external
+ file is updated. This would allow a data structure to be kept in
+ sync whenever its text configuration file is changed.
+
+
+
+local/global/builtin variable lookup
+==============================================================================
+Cheetah currently does not allow users to override Python's builtin functions.
+This provides safety because it prevents users from overriding e.g. $str and
+breaking Cheetah horribly. However, it also prevents users from using common
+placeholder names such as $file, $max, $property, etc.; often requiring
+convoluted circumlocutions to shadow a database field that's named one of
+those. Worse, the application developer (template maintainer) can't be sure
+the user's version of Python won't have a new builtin defined that will make
+the template fail.
+
+Related to this is the question of whether to use bare variable names for
+lookup of local/global/builtin variables. Currently at compile time, Cheetah
+looks for a local/global/builtin variable and, if found, generates a bare
+variable name. If it's not found, it generates a a NameMapper lookup instead.
+Lookup of bare variable names is much faster, but it complicates the
+implementation and may contribute to the can't-override-builtins problem.
+
+To get rid of bare variable names in compiled templates, we'd need to add
+the equivalent objects to the searchList:
+ 1) locals()
+ 2) "#set global" variables
+ 3) ... [user-defined searchList] ...
+ 4) self -- the compiled template object
+ 4) globals() -- for imported objects
+ 5) __builtins__
+The order these objects appear in the searchList may be subject to debate.
#entry $func($arg1, $arg2="default", $**kw)
===============================================================================
@@ -202,4 +176,3 @@ Examples
database? Caching template classes and/or instances extracted from
a database.
- Pickled templates?
-