Passing parameters to Pyhton method
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" Thank you... _______________________________________________________________ Yahoo! Messenger Nueva versión: Webcam, voz, y mucho más ¡Gratis! Descárgalo ya desde http://messenger.yahoo.es
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
=?iso-8859-1?Q?Juan_Manuel_Ruiz_Garc=EDa?= writes:
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... You did not create a record but individual (unrelated) entries in "REQUEST".
Today, I made the "ZPublisher.HTTPRequest.record" class available in (my local) "Products.PythonScripts.standard". Looks like: security.declarePublic('record') import ZPublisher class record(ZPublisher.HTTPRequest.record): _guarded_writes= 1 def __init__(self,dict=None,**kw): if dict is not None: self.__dict__.update(dict) self.__dict__.update(kw) It will not help you in DTML, but could in a Python script. Dieter
participants (3)
-
Dieter Maurer -
Juan Manuel Ruiz García -
Oliver Bleutgen