[Web-SIG] htmlgen

Ian Bicking ianb at colorstudy.com
Thu Oct 30 11:44:52 EST 2003


On Thursday, October 30, 2003, at 10:33 AM, Gregory (Grisha) Trubetskoy 
wrote:
> HTMLgen has a DocumentTemplate thing which is a bare bones templating
> system allowing for substitution in a text file. I think something
> primitive of this sort and perhaps implemented based on this:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330
>
> (which can probably be even further optimized)
>
> would be nice to have in stdlib.

A templating system in its most naive form is just a kind of string 
substitution.  If that's the kind of thing we're looking for, then 
perhaps -- but it has to be usefully better than %.  (Though % would be 
more useful if it had other formatting options, like %h does HTML 
quoting, or %u does URL quoting... but where would it stop?)

There's a PEP out there for $ string substitution, but it's static 
substitution (i.e., it always fills from locals()).  Guido just 
mentioned recently on python-dev that he didn't want to improve % 
(specifically a request that "%{var}" be equivalent to "%(var)s") 
because he wanted to leave room for a better solution.  What better 
solution?  I don't know... I think it has to be something both elegant 
and useful, minimal and flexible.

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the Web-SIG mailing list