[mod_python] Re: Speaking of Output Filters....

Lee Brown administrator at leebrown.org
Wed Apr 12 08:25:32 EDT 2006


Thanks to Graham and Daniel for the info on bucket brigades. I think I've
got my head wrapped around it now.

If I'm grasping this correctly: not only can one request call the filter
multiple times, but overlapping requests may be calling the filter multiple
times.  The filter therefore needs to preserve its state in a thread-safe
way, and as far as the filter is concerned the req object is a persistent,
thread-safe place to put a buffer.

If filter.read() returns '', this means you've hit the bottom of the current
bucket and it's time to update the buffer.  If filter.read returns None,
you've hit the end of the request stream and it's time to proceede with the
filter operation.

If I'm still missing something, please let me know....

Best Regards,
Lee E. Brown
(administrator at leebrown.org)

More information about the Mod_python mailing list