Thanks. I wanted to avoid monkeypatching render_template(), as it's not a small/trivial function. There may be better candidates for this though, such as the Stream.serialize(). Which brings up another question - if we do override trac's functions, should we keep a list of such changes somewhere, so that when we introduce a new trac version into BH things get synced properly?
-- matevz On Thu, Nov 29, 2012 at 10:53 PM, Branko Čibej <[email protected]> wrote: > On 29.11.2012 22:02, Matevz Bradac wrote: >> Would it be possible to do this in the post processing phase, i.e. >> IRequestFilter's post_process_request()? >> If not, is there any way of overriding trac's behaviour without >> modifying trac itself? > > Sure is. > > def better_render_template(self, etc...) > pass > > import chrome > chrome.Chrome.render_template = better_render_template > > This change will persist for the duration of the Python interpreter, > even across subsequent "import chrome" statements. It's best to do this > very early during BH intialization. > > N.B.: I haven't actually looked at what the names of the modules > actually are, but you get the idea. > > -- Brane > > -- > Branko Čibej > Director of Subversion | WANdisco | www.wandisco.com >
