[From time to time, "Software Roundup" will appear in a bonus edition, evaluating according to obscure criteria the members of an overly bifurcated software category. Only Crummy Premium subscribers ($24.95/year) will be spared this exclusive content.] By my side-of-the-envelope calculation, there are more Python templating systems than there are Rocks 'n' Diamonds levels. I've skimmed some web pages and tried to get a few of them to work, so I am now an expert on Python templating systems, at least as regards whether or not I can use them in NewsBruiser.
Here are my showstoppers for any module I might want to incorporate into NewsBruiser. The first two are born of my design goal of making NewsBruiser work for anyone whose hosting service has Python available and who can unzip a tarball. The last one is due to the unfortunate reality of software licensing. I've looked at the template systems with these showstoppers in mind, which means that often I'll simply dismiss a possibly deserving module without really looking at it; this is not a reflection on the module.
First, the ones I can't or won't use: Cheetah: Beautiful Velocity-like syntax. Seems written for Python 2.2 from beginning to end, unfortunately, and it's a lot of code. Otherwise I would definitely use this.
Zebra: XML-based. Somewhat language-independent, which is a cool idea. GPLed, so I can't use it.
PSP I couldn't get to work.
empy is GPLed.
htmltmpl is Python 2-specific.
XIST looks like a good idea but is Python 2.
[STOP PRESS! Crummy Premium subscription now only $24.91/year! Such a deal!] Yet Another Python Templating Utility works, but I really don't like its template format. XYAPTU is much better-looking, but contains a 2.2ism which I can't get rid of. If I could make it 1.5-compatible, XYAPTU would be a contender; stay tuned.
PyMeld has some of the control flow logic in Python, but not as much as template (see below). It's 2.2-only, though.
Wasp is a whole web framework, and the syntax is acceptable, but again: Python 2.
Now, the actual contenders: template has all the control flow logic in Python rather than in the template, which I don't like, but I don't see any reason why it wouldn't do the job.
AHTS has a slightly awkward API, and the examples don't work as is, but otherwise seems to work. It looks like it only accepts variable substitution by name, though.
tinpy took just a little work to get working in 1.5. It has a ?SP-like syntax, which is okay, but you can't access members or make method calls from within templates; it has to be variable references, dictionary lookups, etc. Otherwise, I think this is the best one for me.
So, unless I find something else that's better (do you know of any?), or I can get XYAPTU to work, I'm probably going to hack up AHTS or tinpy to fit my needs.
Tue Apr 29 2003 21:38 Python Templating System Roundup:
