PSP, Cheetah, PTL, ZOPE, etc ...
Chuck Esterbrook
ChuckEsterbrook at yahoo.com
Wed Aug 1 14:14:01 EDT 2001
grahamd at dscpl.com.au (Graham Dumpleton) wrote in message news:<dc6f5c99.0108010315.70be0de0 at posting.google.com>...
> Go to:
>
> http://webware.sourceforge.net/Papers/Templates/
>
[snip]
> What I am wanting to know is what we have learnt from all of this. If
> one were designing yet another template system, what might be the best way
> of approaching it? The idea being for it to be simple in appearance and
> use, yet be powerful enough to harness features within the back end server.
We *did* design YATL this past spring. It started with some examples
and discussion on the webware-discuss list. Cheetah emerged as our
victor for various reasons including [a] we liked the design and [b]
the author took it to maturity.
Although the docs don't reflect it yet, Cheetah will pretty much be
the recommended templating solution for Webware developers.
So no one gets confused: Cheetah is an independent project and can be
used sans Webware. Also, Webware could be used with any Pythonic
templating solution (I have even baked my own simple ones from time to
time).
Also, Zope is a web dev environment, not a templating language. More
specifically, Zope has 2 templating languages: DTML and ZPT. I'm not
sure if StructuredText counts as one because I forget if it allows for
substitution of variable names.
The approximate consensus seems to be that DTML is "old school" and
that ZPT is the new, shiny way to do templating in Zope. That brings
us to my next topic:
Outside of *SP, the 2 major templating camps that I see are "dollar
sign/pound" or $#, and *ML.
In $# you use $ for substitution, often with dotted notation such as
$employee.manager.salary, and # for directives like #if, #for, and
#set. The idea is to provide enough power for simple display logic,
but to keep your application logic outside the templates.
Packages in this camp include Cheetah, Webmacro and Velocity, the last
2 of which are for Java.
The *ML camp uses XML or XML-like tags for all instructions and
substitutions. These include ZPT, Ehydra and others. There is a *ML
like kit for Webware, but I don't think any serious time was put into
it, hence it is hard to recommend (for Webware).
In any case, I prefer the $# approach because it is:
- very easy to write
- very easy to read
- very easy to learn
(hmmm, kind of like Python)
- understandable by non-programmers (like an HTML designer)
- uses few symbols (mostly just $ and #)
- works with all formats (plain text, SQL, HTML, etc.)
- language neutral on the outside
Some prefer the *ML approach because...? Maybe they like the
structured nature of mark up languages. Disclaimer: When you're not a
proponent of something, it's hard to represent that something's user
base. For example, I no longer have any idea why people use Java and
Perl. :-)
Some clickables:
Cheetah, Python-powered templates
http://www.cheetahtemplate.org/
Webware, Python-powered web dev
http://webware.sourceforge.net/
Hope that helps,
-Chuck
More information about the Python-list
mailing list