[Zope] Now I'm confused....
Dave Kuhlman
dkuhlman at cutter.rexx.com
Mon Aug 30 12:41:24 EDT 2004
On Sun, Aug 29, 2004 at 12:58:02PM -0700, Bill Hewitt wrote:
> I have finally given up on the complexity of ZClasses.... So, nowI am
> porting my ZClasses to Python Classes..
> Here is the rub:
> How do I get the Python Class to recognize DTML Methods
>
> I have a DTML method called "getDate" and I *assume* that I call it from
> inside the Python class with something like:
>
> getDate = HTMLFile('dtml/getDate', globals())
>
> but when I try to use this, "'getDate' is not defined" is what is
> returned from Zope....
>
> So, how does one include DTML Methods, PythonScripts, etc.... as methods
> in Python Classes?
>
> I have been looking and looking for some sort of example, but I can seem
> to find one....
Where are your calling the DTML Method from? Is the call in a
Script (Python) in the same folder as the DTML Method?
If so, here is an example:
# Call the DTML Method "show_hippo".
#
request = context.REQUEST
dtml_method = context.show_hippo
# Call the dtml method.
s1 = dtml_method(client=context, REQUEST=request)
# s1 now holds the rendered html
return s1
There is some explanation in "The Zope Book Chapter 15:
Advanced Zope Scripting"
(http://zopewiki.org/ZopeBookChapter15AdvancedZopeScripting);
search for the section titled "Calling DTML from Scripts".
Dave
--
Dave Kuhlman
http://www.rexx.com/~dkuhlman
More information about the Zope
mailing list