[Zope] Calling Python script from ZPT - Solution
Chris Withers
chrisw at nipltd.com
Thu Sep 4 10:48:03 EDT 2003
Bart Hubbard wrote:
> Whoops! Good point. I had edited my question many times w/o changing the title. My real situation is a little more
> complex than the question I'd posed. What I'm really doing is trying to do in ZPT what I was doing in a DTML doc. I
> also wanted to clean up my design by moving the logic to my script.
Well, post the bits of ZPT and Python Script that aren't working and I can help ;-)
> # Call the method in the context of that item and return the results
> retVal = dtml_method(client=item, REQUEST=REQUEST)
If you could make that not DTML, your life would get even easier, since to call
a page template, you could replace:
# Prepare to call the view method on the content object
dtml_method = item.view
REQUEST = context.REQUEST
# Call the method in the context of that item and return the results
retVal = dtml_method(client=item, REQUEST=REQUEST)
return retVal
with:
return item.view()
...since ZPT has very well defined and consistent calling semantics, whereas
DTML doesn't ;-)
cheers,
Chris
More information about the Zope
mailing list