[Zope] Adding a ZPT when adding product instance

Dieter Maurer dieter at handshake.de
Sat Jan 10 15:40:40 EST 2004


Lee Harr wrote at 2004-1-10 15:33 +0000:
> ... reading product related file ...
>Ok. That was actually my first thought, but how do I find the directory
>in which my product?  This is how I have done it ...
>
>
>    dirname = os.path.dirname(__file__)
>    zpt = os.path.join(dirname, 'zpt')
>    index_html = open(os.path.join(zpt, 'index_html.zpt'))

There is a "package_home" function defined in "App.Common"
(available via "Global") which can determine the package
directory in many cases.

> ...
>I could not find PageTemplateFile from my script... it is not in Globals 
>with
>HTMLFile.

It is in "Products.PageTemplates.PageTemplateFile".

>I also found package_home in Globals while looking through
>ZopePageTemplate.py but I am not quite sure how to use it.p

You pass "globals()" as argument.

-- 
Dieter



More information about the Zope mailing list