I don't know whether this is a genshi question or a trac question, but
I'll start here and relocate if need be.

I have two plugins for my Trac installation.  Each of them has perhaps a
peculiar need: they each implement ITemplateStreamFilter.filter_stream,
and in filter_stream they each need to examine stream content to make
decisions about what filter operation to perform.

I don't know a lot about what I'm doing, but it seems that as soon as
I do anything (.render(), .select()) to the stream, it is consumed
completely and is no longer available to be filtered.  I've determined
that I can "copy" it by rendering HTML and re-parsing that:

        html = stream.render()
        # or: html = stream.select('.').render()
        copy = genshi.XML(html)
        stream = genshi.XML(html)

This works, as far as my immediate needs.  However, each of my plugins
also uses trac.web.chrome.add_script() to add a javascript source to the
output.  But somehow, for reasons I've been unable to find, if I consume
my stream and reinstantiate it, all the scripts added by plugins to the
request via add_script() are lost.  (I could probably use Transformer to
work around this in my plugin, but it still ruins the day for any other
plugins making use of add_script().)

Can anyone tell me what I'm doing wrong, where to find documentation
relating to this problem, anything?  I'm feeling pretty exhausted on it.

Thanks.
-- 
 -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
-~----------~----~----~----~------~----~------~--~---

Reply via email to