[Zope] Page template in Python-based product. How?

Rene Pijlman rpijlman@wanadoo.nl
Mon, 18 Jun 2001 23:30:39 +0200


>I'd like to use Page Templates in a Python-based product instead
>of DTML templates. How do I add a Page Template to the product?

For the record (and the archive), I'll answer my own question.

Looking at the source (PageTemplates/ZopePageTemplate.py) this appears to=
 do
the trick:

    from Products.PageTemplates.PageTemplateFile import PageTemplateFile
    foo =3D PageTemplateFile('bar', globals())

The implicit filename extensions is ".zpt", so the filename in this examp=
le
must be 'bar.zpt'

As far as I can tell this works much the same way as Globals.HTMLFile(), =
as
documented in http://www.zope.org/Members/hathawsh/PythonProductTutorial.
But please correct me if I'm wrong.

Regards,
Ren=E9 Pijlman