> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> On Behalf Of David Champion
> Sent: Monday, April 27, 2009 7:55 PM
> To: [email protected]
> Subject: [Trac] Re: genshi stream consumption in trac filter plugin
>
>
> * On 27 Apr 2009, Noah Kantrowitz wrote:
> >
> > 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.
>
> Well, I know, it makes my eyes bleed, but I couldn't find any other
> approach. I want the result more than I want performance in this case.
>
> Two things I'm trying to do:
>
> 1. Make a plugin that filters only if a certain token appears in the
> original content. It's a report/query filter. I don't want to
> perform the filter for all reports, but there's no way to identify
> exceptions by URL or user ID, only by the content of the page.
The full data dict used with the template is passed in. Lets say you want to
filter all requests with "OMG" in the title:
if req.path_info.startswith('/report/') and 'OMG' in data.get('title, ''):
stream |= Transformer('blah').remove()
return stream
--Noah
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---