[ANN] HTMLTemplate 1.0.0

has has.temp2 at virgin.net
Wed Jun 9 17:19:09 CEST 2004


David Bolen <db3l at fitlinxx.com> wrote in message news:<un03faxcs.fsf at fitlinxx.com>...
> grahamd at dscpl.com.au (Graham Dumpleton) writes:
> 
> > Now as to other template systems that are event driven system friendly,
> > the only one I know of for Python is Nevow, [...]
> 
> Note that even if the template system isn't directly event driven
> friendly, it can generally be used just fine with Twisted since you
> can acquire your data prior to rendering the template.  

I think what Graham's getting at is that developers shouldn't have to
jump through such extra hoops just to compensate for design
deficiencies in the templating engine. The templating system ought to
integrate nicely with the rest of their system, not vice-versa.
HTMLTemplate is better than average here, but obviously still falls
short; we've been discussing off-list how best to rectify this
shortcoming, so will hopefully have something better soon.


> HTMLTemplate could be inserted into the same mix

Ah, the damnation of faint praise... :o)


> as long as we held
> off asking HTMLTemplate to render the DOM into HTML until we had all
> the necessary data acquired to answer the various callbacks
> immediately. 

Current thinking for the revised HTMLTemplate behaviour is:

1. Lose the main Template callback, whose only real raison-d'etre is
to automate the clone() and result() operations on either side of the
user's DOM manipulation. Eliminating this will better decouple data
insertion from HTML rendering at the cost of a couple more lines of
user code.

2. Modify the Repeater class's repeat() method, which currently
renders a list of items, replacing any previously rendered content
(meaning you have to have your whole list prepped in advance), to
allow it to be called any number of times, each time adding new items
to those already there (allowing items to be added as and when the
data becomes available).


> That's probably the biggest advantage of Woven/Nevow in
> a Twisted context with respect to a more MVC model - they integrate
> cleanly into Twisted's event driven fabric with deferreds even during
> individual element callbacks so you don't have to prepare all the data
> in advance but can be driven from the template rendering process.

This is the level of flexibility I'd like to achieve with the revised
[event-friendly] HTMLTemplate design (though without losing the clean.
simple implementation and execution model it currently has). If you've
any suggestions here, please fire away.



More information about the Python-list mailing list