[Zope] Problem: Calling DTML Method from ZPT

Steve Spicklemire steve@spvi.com
Sat, 4 Aug 2001 16:50:02 -0500


Hi Dieter, Mike,

Hmm... well technically I think it's optional:

     def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
         """Render the document given a client object, REQUEST mapping,
         Response, and key word arguments."""


it depends on whether something you're using *in* the DTML needs 
something that can only be gotten from the REQUEST. Since Mike didn't 
say anything about the DTML he was calling... it could be either way. 
However.. you are right Dieter.. that putting in the REQUEST 
shouldn't(/couldn't?) hurt.. but my point would be that it's also not 
necessary, unless of course it's necessary. ;-) It's also true that 
unless the <p ... /> tag was the only thing in the ZPT object, then his 
traceback shows that the resulting HTML would've been invalid anyway, 
since the DTML he was calling was somehow invoking standard_html_header 
which normally starts out with <html>....

take care,
-steve

On Saturday, August 4, 2001, at 04:36 PM, Dieter Maurer wrote:

> Mike Murphy writes:
>> I still got a TALES error in trying what you suggested:
>>
>> <p tal:replace="structure
>> python:root.games.hangman.index_html(root.games.hangman)"/>
>> ...
>>     (Object: PARENTS[-1].applications.guestbook.entryForm)
>>     (Info: PARENTS)
>>   File <string>, line 2, in f
>>     (Object: guarded_getitem)
> You need to pass "request" as second argument!
>
>    <p tal:replace="structure
>    python:root.games.hangman.index_html(root.games.hangman,request)"/>
>
>
> Dieter