[Zope] Calling a ZPT on an object

Felix Ulrich-Oltean felix@chaptereight.com
Tue, 27 Aug 2002 13:45:00 +0100


Hi

I have made a python Product and I'm trying to set up its public
view.  The user can pick (per instance) which template to use from a
folder-full of templates.  I want the index_html method of my object
to call the chosen template with the correct bindings, i.e. here
should refer to my object instance.

The templates are stored in the root of the site in a folder called
"zest_templates/news", and my object has a property called "template"
which is the id of one of the PT's in to folder.  So, my attempt is
below, but obviously it does not work, specifically, the "here" is not
bound correctly.

    def index_html(self, REQUEST=None):
        """Front-end view of the story."""
        return self.zest_templates.news[self.template](self, REQUEST)
    
How can I do this?

TIA

Felix.