* On 27 Apr 2009, Noah Kantrowitz wrote:
>
> All Genshi filters should always be generators.
Sorry, not following. If my filter consumes a stream, produces a
stream, and returns that stream, is it not still generating?
def filter_stream(self, req, method, filename, stream, formdata):
html = stream.render()
newstream = genshi.XML(html)
xpath_1 = '...'
xpath_2 = '...'
if 'magic word' in html:
return newstream | Transformer(xpath_1).remove()
else:
return newstream | Transformer(xpath_2).remove()
If it weren't a generator the plugin would not return content at all,
no? As it is the plugin returns content, it's just wrong because I
can't work out this conflict.
Maybe I mistake your point?
--
-D. [email protected] NSIT University of Chicago
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---