[ZPT] Re: PageTemplateFile + METAL don't work + patch
Evan Simpson
evan@zope.com
Mon, 15 Oct 2001 10:08:17 -0400
Steve Alexander wrote:
> You can't use PageTemplateFiles that define METAL macros. It seems they
> never get compiled, so they don't get found at runtime, so you get errors.
Ah, thanks. I've fixed this in CVS.
> The solution is to make sure PageTemplateFiles cook their code on __init__.
I've made them _cook_check() on each access of .macros, which is lazier and
handles changes in debug mode.
> Here's a patch against today's CVS. Oh, it includes my last patch in to
> fix "Ambiguous name" errors at start-up too.
The whole "Ambiguous name" business is intended to highlight places where a
Product author is using the same object under more than one name, without
explicitly declaring which name's security declarations are authoritative.
With the changes I've made, the proper way to handle this is with a
constructor keyword argument:
security.declarePublic('view')
index_html = PageTemplateFile('www/fooView', globals(), __name__='view')
view = index_html
Thanks,
Evan @ Zope