Hello: I'm working in a skin within CMF 1.2 and Zope 2.5.0... 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) . What causes this? Lack of parameters? What am I missing here? Kind Regards, Damon.
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 ----- Original Message ----- From: "Damon Eckhoff" <eckhoffd@missouri.edu> To: <zope@zope.org> Sent: Monday, March 25, 2002 11:20 PM Subject: [Zope] call DTMLMethod with parameter from Python
Hello:
I'm working in a skin within CMF 1.2 and Zope 2.5.0...
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) . What causes this? Lack of parameters?
What am I missing here?
Kind Regards,
Damon.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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? I appreciate the help. Kind Regards, Damon.
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)
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
Robert Rottermann writes:
In ZPT _ is here. Therefore you could try : <span tal:replace="structure python:here.myDTMLMethod( None, here, optionalkey1='yada' )"> ... I do not agree with this statement:
There is no equivalent of "_" in ZPT: The ZPT namespace is flat, initially filled with the predefined variables "here", "user", "nothing", ... and augmented by the variables defined by "tal:define". Furthermore, "here" corresponds to the "client" of DTML objects (and is similar to "this"). It is an object while the second parameter to DTML objects requires a mapping. You probably would use something like: <span tal:replace="structure python:here.myDTMLMethod(here, request, ..."> Dieter
Damon Eckhoff writes:
I'm working in a skin within CMF 1.2 and Zope 2.5.0...
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' ) The doc's say something like "__call__(client=None,REQUEST={},Response=None,**kw)".
Probably, you should use: context.myDTMLMethod(context,context.REQUEST,optionalkey1=...) Please read "Calling DTML objects" in <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> for details. Dieter
participants (4)
-
Damon Eckhoff -
Dieter Maurer -
hans -
Robert Rottermann