[Zope] call DTMLMethod with parameter from Python
hans
hans@beehive.de
Tue, 26 Mar 2002 19:40:34 +0000
Damon Eckhoff wrote:
> I understand that... Let me rephrase...
> I have myZPT with a form. The action of that form
> is myPythonHandler. I want to call myDTMLMethod from
> within myPythonHandler to format data submitted by the
> myZPT form into a string.
>
> so from within myPythonHandler:
> result_string = context.myDTMLMethod( ???requestVars??? )
>
> Is this a reasonable thing to do?
>
http://www.zope.org/Members/michel/ZB/AppendixB.dtml
says for
class DTMLDocument(ObjectManagerItem, PropertyManager)
to call
__call__(client=None, REQUEST={}, RESPONSE=None, **kw)
>
> > I can only give you a hint.
> > In ZPT _ is here. Therefore you could try :
> > <span tal:replace="structure python:here.myDTMLMethod( None, here,
> > optionalkey1='yada' )"> ...
> >
> Robert
>
>
>> I'm trying to clarify how to call a DTML Method with
>> parameters from a python script. The docs I've read
>> say to call it something like this:
>>
>> result_string = context.myDTMLMethod( None, _, optionalkey1='yada' )
>>
>> But the python script I have is being called
>> from a Page Template as a result of a form action. I
>> don't understand how to change this to work without the _ or how to
>> pass a REQUEST mapping to the DTMLMethod.
>>
>> Currently, when I make the call:
>>
>> result_string = context.formatResult()
>>
>> result_string actually contains the dtml code of formatResult
>> (un-rendered)
-------------------------------------------------------------
Who's got only a hammer sees the world as a nail
hans augustin (software developer) hans@beehive.de
beehive elektronische medien GmbH http://www.beehive.de
phone: +49 30 847-82 0 fax: +49 30 847-82 299