Standalone ZPT?

Paul Boddie paul at
Thu Aug 22 10:21:53 CEST 2002

richie at (Richie Hindle) wrote in message news:<8a6ba1da.0208210040.1159f31b at>...
> Gerhard,
> > Are there any other Python templating systems that work like ZPT (i. e.
> > use attributes instead of custom tags)?
> You could look at PyMeld, my very lightweight HTML manipulation module:


> PyMeld has no special requirements for the HTML, other than that each
> tag you want to manipulate must have an 'id' attribute, and the attribute
> values must be quoted.  It works by string substitution rather than by
> parsing and rebuilding the document, so it's immune to invalid or
> incomplete HTML, as long as the pieces you want to manipulate make sense.

I've also written a template system which uses 'id' attributes,
although it is extensible enough to permit other "structure
annotation" styles (see for an
explanation of that jargon). Unlike PyMeld, it uses the various XML
libraries and deserves to be a bit faster - I'm going to see what
cDomlette can bring to the table in that respect, although a previous
iteration of this work did use some "proxy" classes to wrap XML
documents in a more abstract API, and that was even slower. :-)

Another thing which distinguishes it from PyMeld is that the
"instantiation" process involves a single call and requires the data
used in the final output to originate from an XML document (which
should have been loaded into a DOM tree, of course). If XML-centric
projects aren't your thing, then I can imagine that this might cause
your interest to be discontinued almost immediately, although I'm sure
a refactoring could permit other structure types to be employed
directly; indirectly, one can already convert dictionaries to XML
documents on the basis of a naming convention used in the keys
employed in such dictionaries - this can be helpful in the processing
on incoming Web form data, for example.

I haven't released this work yet, partly because there are so many
things I want to do with the template parts, and partly because I
became ambitious and introduced some kind of relational database
serialisation for the XML which uses user-defined table descriptions,
but I'm sure that at some point, I'll tidy it up and make some kind of


More information about the Python-list mailing list