[Zope] Calling a dtml method from a product

Geoff Armstrong geofstro@monaco.mc
Wed, 3 Apr 2002 17:11:55 +0200


At 15:54 +0100 3/4/02, hans wrote:

><dtml-call "REQUEST.set( 'yourname', yourvalue)">

Yes, I have a number of such calls in the DTMLMethod I'm attempting 
to call from the python product.

>
>>  I know this must seem like a dumb question; but can you tell me how
>>  to pass an empty REQUEST object in the call, so the DTMLMethod can
>>  set and make use of these variables?
>>
>  > __call__(myDTMLMethod, REQUEST???)
>
>NOTE: better ask zope@zope.org, so all member may profit :-)

My mistake. Sorry all. I'll make sure to use "reply to all" in future.

>a) REQUEST is an object that seemingly behaves just like a python
>dictionary
>b) the __call__-method of DTMLMethod has REQUEST={},
>so by default if no 2nd parameter is given, it is empty. Note that
>DTMLMethods
>are usually interpreted in the context (=namespace) of their caller.
>c) the third parameter **kw is a sequence of keyword parameters.
>

So does that mean I need to pass an empty dictionary as the second 
parameter to _call_  so that my DTMLMethod will have a REQUEST object 
that it can start filling with variables using <dtml-call 
"REQUEST.set( 'yourname', yourvalue)"> ?

Could you provide the exact syntax I need to use in _call_ ? Whatever 
I try, I always get the error "global name 'REQUEST' is not defined"?

Presumably because the DTMLMethod I'm calling is trying to set 
variables in a REQUEST object; but it's not getting one, and I still 
don't understand how to provide this. I'll also need to provide some 
other variables to the DTMLMethod. I guess I need to use **kw for 
that?  Again the exact syntax I need to use, by example, would be 
appreciated.


The end of the traceback is as following:

(Object: REQUEST.set('newsMgr', id))
(Info : REQUEST)
  File <string>, line 2, in f
NameError: (see above)

thanks


geoff