[Zope] a question about python and DtmlMethod in ZOPE
Dieter Maurer
dieter@handshake.de
Fri, 27 Jun 2003 01:28:16 +0200
leiz@esiee.fr wrote at 2003-6-26 14:29 +0300:
> ...
> I want to return a dtmlMethod in a python script in Zope as follow,
> but I failed.
>
> the python script is:
> ...
> return context.Data_cand_view
> -----------
>
> in which the 'Data_cand_view' is a DtmlMethod, but it isn't returned.
Are you sure? What is returned?
The "return" above does return the DTMLMethod object (!).
This may result in a cryptic error message (indication the the
ZPublisher was unable to convert the object into a string) or
(earlier Zope versions) result in an apparently empty page
(when you look at the page source, you will see
"<DTMLMethod instance at ...>").
What you probably want is not to return the DTMLMethod itself
but the result of rendering the method. In this case, use
return context.Data_cand_view(context,container.REQUEST)
Dieter