Yeah, thats a horrible idea right there. It will result in a huge amount of memory being used for every page render. Generators are a type of iterator that work effectively on-demand. What _exactly_ are you trying to do.
--Noah > -----Original Message----- > From: [email protected] [mailto:[email protected]] > On Behalf Of David Champion > Sent: Monday, April 27, 2009 7:14 PM > To: [email protected] > Subject: [Trac] Re: genshi stream consumption in trac filter plugin > > > * 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 -~----------~----~----~----~------~----~------~--~---
