On 2/18/06, Todd Thomas <caliban19@gmail.com> wrote:
On 2/15/06, Matt Helm <code.name.eric@gmail.com> wrote:
On 2/14/06, L. Daniel Burr <ldanielburr@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@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
One other thing, rpy will automatically cache the instance you create if its in your resource class. Which means you will only take the hit once when initially creating class. So it may block briefly depending on size of template, but afterwards, should be as fast as calling request.write on a class directly, which is basically what your are doing. ToddB