Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 33237
Status: rejected
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: mkanat [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.19
Fixed in: (no value)



Subject: PARSER needs to be set up after CONSTANTS and before SERVICE
We just created a custom Parser class for Bugzilla, and discovered that our constants disappeared when we did it. This is apparently because Template->_init doesn't do things in the right order. You can see what we had to do to fix it, here, which also explains the bug fairly nicely: https://bugzilla.mozilla.org/attachment.cgi?id=303127&action=diff#../head/Bugzilla/Template.pm_sec2
On Wed Feb 13 17:32:28 2008, MKANAT wrote: Show quoted text
> We just created a custom Parser class for Bugzilla, and discovered > that > our constants disappeared when we did it. This is apparently because > Template->_init doesn't do things in the right order. > > You can see what we had to do to fix it, here, which also explains the > bug fairly nicely: > >
https://bugzilla.mozilla.org/attachment.cgi?id=303127&action=diff#../head/Bugzilla/Template.pm_sec2 Thanks for the info. I can see the problem you're having and the solution you've implemented seems adequate for your purposes. However, I don't think it's something I can feed back into TT2 because it changes a key behaviour. That is, it always forces a parser object to be loaded and created. Although it's not widely documented, you can run TT using pre-compiled templates only. In this case the parser is never loaded (and can actually be left off the system entirely if a particularly rigid security policy requires it, for example). Your implementation changes that to always load and instantiate a parser regardless. So I think I'll have to reject the change for TT2 in order to maintain the status quo. But I'll certainly improve the initialisation code in TT3 so that you don't have to jump through the extra hoop when it comes to subclassing. Cheers Andy