[mod_python] Output Filters Redeaux

Nick nick at dd.revealed.net
Mon Apr 17 23:24:57 EDT 2006


Graham Dumpleton wrote:
> Overall I can't see how it could be made to work, at least I can't see how
> it could be made to work easily. The basic problem is that on each call into
> a filter, it is a different filter object associated with different buckets in the
> bucket brigade. So although within the context of a single filter call, you
> might be able make the filter object iterable, you probably can't have one
> bit of code which somehow transparently bridges the multiple calls to the
> filter even if using a generator somehow, which is what I think the suggestion
> was about. I don't truly grok all that can be done with generators and so
> there may indeed be a way, but it would probably need to use multiple
> levels of indirection to get around fact the filter object changes.

See attached sample code for how to accomplish this in pure Python.
This is quick and dirty and really needs to be made more thread safe.

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mp_filter.py
Type: text/x-python
Size: 1746 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20060417/b495a1ed/mp_filter.py


More information about the Mod_python mailing list