logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: buffering output: msg#00084

Subject: Re: buffering output
Myk,

Thanks for your detailed answer. It's nice to know this will be in TT3, but
the future is not quite now, as you so enthusiastically stated, since TT3 is
still under development.

I'll check out your FLUSH directive when (actually, if) I have time, but I
would honestly prefer a less kludgey solution (no offense to your effort
intended). So for now I'll wait until TT3 is out.

Scott

On Mon, 23 Feb 2004 13:34:08 -0800 Myk Melez 
<myk-4eJtQOnFJqFAfugRpC6u6w@xxxxxxxxxxxxxxxx> wrote:

> Scott Weisman wrote:
> 
> >does tt2 buffer output?
> >
> Yes, and it doesn't flush the buffer until it finishes processing the 
> template.
> 
> >On Apr 9,  4:42pm, Jacques Supcik wrote:
> >  
> >
> >>Is it possible to have an unbuffered output with the templates?
> >>    
> >>
> >
> >Andy replied: "Not in the current version, although it is planned for the
> >future."
> >  
> >
> The future is now, and Andy is implementing this in TT 3.0.
> 
> 
> >If it is NOT possible to have unbuffered output, can anyone suggest an
> >alternative?
> >
> One solution is to break up your template into a sequence of templates 
> and process each separately.
> 
> I had the same problem a few years ago and implemented a FLUSH directive 
> that flushes the output buffer.  It's a partial implementation that 
> requires a little care to use, since if you put it into a block you 
> might end up flushing the output of the block before the output that 
> precedes the block, but that's relatively easy to work around (just make 
> sure to FLUSH at the beginning of blocks if you plan to flush in the 
> block).  It can make a significant difference in the perceived 
> performance of your web application (we use it to return partial results 
> of bugzilla.mozilla.org searches before the full results are available).
> 
> Unfortunately the latest TT version it definitely works with is 2.07.  
> I've updated it for 2.08, and it seems to work there, but it fails a few 
> tests.  I haven't tried updating it to 2.12 much yet (my first attempt 
> failed with major conflicts), but in theory it should be possible.  The 
> code is here:
> 
> http://bugzilla.mozilla.org/attachment.cgi?id=79922
> 
> Note that you need to recompile the grammar in the parser subdirectory 
> of the distribution, which is quite simple but may require some 
> additional software.  Just read the README in that directory for 
> instructions.
> 
> Here is the thread about my patch from when I originally implemented it 
> two years ago:
> 
> http://www.template-toolkit.org/pipermail/templates/2002-February/thread.html#2788
> http://www.template-toolkit.org/pipermail/templates/2002-March/thread.html#2861
> 
> And here's the email I sent to the TT3 mailing list explaining the 
> implementation:
> 
> http://www.template-toolkit.org/pipermail/tt3/2004-January/000040.html
> 
> -myk
> 
> 


<Prev in Thread] Current Thread [Next in Thread>