[Twisted-web] Using Cheetah with twisted.web

Todd Thomas caliban19 at gmail.com
Sat Feb 18 13:24:18 MST 2006


On 2/15/06, Matt Helm <code.name.eric at gmail.com> wrote:
>
> On 2/14/06, L. Daniel Burr <ldanielburr at mac.com> wrote:
>
> > Probably.  Rendering your template in this way will most certainly block
> > the reactor, since Cheetah templates don't support Deferreds.  On the
> > other hand, if the template is rendering *very* quickly, then this code
> > might not block for long enough to actually matter.
>
> That is what I suspected. I will call the Cheetah template in
> deferToThread.
>
> Matt.
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>
Why not just compile your template at the head of the file using,
Template.compile(file="path"). I did some experimentation with this, and it
is very fast. Only time I could see where deferred would be useful is when
you are compiling it initially, if you precompile your templates and dont
call any blocking functions within it, it will be more than fast enough.

ToddB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20060218/a6623b77/attachment.htm


More information about the Twisted-web mailing list