[Zope] Passing parameters to Pyhton method

Oliver Bleutgen myzope@gmx.net
Fri, 13 Sep 2002 12:04:32 +0200


Juan Manuel Ruiz García wrote:
> Hi all,
> 
> I'm trying to do something that maybe can't be done...
> 
> First, I get some variables joined in DTML variable "present" with:
> 
> <dtml-call "REQUEST.set('present.name',name)">
> <dtml-call "REQUEST.set('present.lastname',lastname)">
> 
> If I use
> 
> <dtml-var present.name>
> 
> I can see what I expected (the name), but I want to pass the "present"
> "record" to a Pyhton Method... I know that if I build a form and use the
> ":record", it would work, but I don't want to build a form unless necessary.
> 
> Zope returns a "NameError" when I call the script with present as a
> parameter. Is there any way to make this work?
> 
> Actually, my "present" variable contains 10 fields, so I just want to pass
> ONLY one parameter instead of 10, that's why I don't want to give all the
> parameters alone, I want them "grouped"


It's not quite clear to me what you gain by "grouping" your variables if 
you have to call REQUEST.set() 10 times to get the grouping together.

Maybe use a parameter in your python script and pass it a dictionary:

<dtml-var "your_script(present={'name':name,'lastname':lastname, ...)">

HTH,
oliver