> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
> On Behalf Of Thomas Vander Stichele
> Sent: Monday, October 27, 2008 4:24 PM
> To: [email protected]
> Subject: [Trac] Re: Updating my HeadLink trac macro from 0.10 to 0.11
> 
> 
> On Sun, 2008-10-26 at 17:16 -0700, Noah Kantrowitz wrote:
> > On Oct 26, 2008, at 4:16 PM, Thomas Vander Stichele wrote:
> >
> > >
> > > On Sun, 2008-10-26 at 07:24 -0700, Martin S. wrote:
> > >> I'm not an expert for this, but I think it's now done using the
> class
> > >> IRequestFilter.
> > >> I don't know If this works also for macros or only for plugins,
> > >
> > > I doubt it, but I will give it a shot.
> > >> but I
> > >> used code like below to add a new
> > >> javascript file to the header in a recent plugin of mine. Maybe
> there
> > >> is also a 'add_link' function.
> > >
> > > Yes, I found the add_link method in web.chrome
> > >
> > > However, it seems that:
> > > - chrome gets created with a fake request object in prepare_request
> > > - this method invokes add_link to add all of the <head> elements
> > > - render_template then resets them, and creates late_links
> > > - when my macro gets executed, the formatter has the 'real' Request
> > > object, which is not the one the template is filled with.
> > >
> > > I can't say I understand the page processing model much in 0.11, so
> > > could anyone shed some light on what's going on here ?
> >
> > You cannot add things to <head> in a macro, as they are rendered too
> > late in the process.
> 
> Ok, so this is a regression from 0.10  Is it intentional or accidental
> ?
> Is it something you consider should be fixed, and I should propose a
> patch for that, or is it just not meant to be done from a macro ?

It is not fixable that I know of. It is intentional to the degree we knew it
would happen, however it is certainly sub-par.

> >  You could do some interesting stuff with string
> > scanning and a request filter though.
> 
> Not sure what you mean by string scanning, but it sounds like you're
> saying I should be able to do it with an IRequestFilter ? Maybe you
> mean
> 'string scanning in the wiki page to detect a similar syntax to macro
> syntax' ?

Yes, the raw wiki text is present in the data dict, can you could go to town
on it with some simple regexes.

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

Reply via email to