[Zope] More trouble with METAL and python product

Peter Bengtsson mail@peterbe.com
Thu, 04 Apr 2002 16:01:26 +0100


Now I see what is wrong but not how to fix it.

I've got this python product that uses ZPTs and METAL. When I first visit 
index_html I get a cryptic error message saying something about the METAL 
definition.
The template that holds the METAL macro is called StandardLook and is 
defined like this:

PTF = PageTemplateFile
StandardLook = PTF('zpt/StandardLook', globals(), __name__='StandardLook')
index_html = PTF('zpt/index_html', globals())

If I then visit StandardLook it works; and thirdly I go to index_html again 
and it works. From then on it works fine.
After I refresh the product the same problem occurs again.

Again....

1. I refresh the product --> no error
2. http://localhost/myinstance/index_html  --> Error!!
3. http://localhost/myinstance/StandardLook  --> no error
4. http://localhost/myinstance/index_html  --> no error


It's obvious that the StandardLook instance needs to be rendered once so 
that Zope can remember that that is the macro template.
How do I solve this? What needs to be done?


Cheers,
Peter