[Zope] Re: Re: Help with unconsistent behavior of parameter passing to Python Scripts.

febb febb@piensa.com, fb@piensa.com
Fri, 12 Apr 2002 09:29:27 -0500


Hi
Thanks for replying.    Sure I did.  Actually I did called the
script from a DTML Method / DMTL Document objects to be
executed as the ACTION of an (html) FORM.

The same thing happenned. It was evaluated as a STRING instead
of as a LIST as it actually is.

I would have expected that the behavior of a plain python program (tested directly
under python prompt), then the same program "ported" to be a Zope python script
tested witht the internal Zope's "test" tab and later on called from DTML would behave
the same.

Any ideas?

Edward

----------------------------------------------------------

> Message: 48
> Date: Fri, 12 Apr 2002 11:00:31 +0200
> Organization: http://freemail.web.de/
> From: <net_seeker@web.de>
> To: zope@zope.org
> Subject: Re: [Zope] Help with unconsistent behavior of parameter passing to Python Scripts.
> 
> Hi,
> looks to me like the test-screen parameter input-field is not evaluated as=
> 
> an python instruction, but as a string. did you try to feed the script
> with a "real" list through dtml/other script =3F
> 
> Torsten
> 
> =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=
> =5F=5F=5F=5F
> Geben Sie Ihren Lottotipp gerne auf den letzten Dr=FCcker ab=3FBeim WEB.DE
> Lottoservice gibt's keine Warteschlangen. http://tippen2.web.de/=3Fx=3D9

-----------------------------------------------------------------------------
> 
>> Hello all:
>> 
>> Having the following Python script:
>> 
>> if same_type(RR,[]):
>>     return "It is a list"
>> if same_type(RR,'abcd'):
>>     return "it is a string"
>> 
>> 
>> If I use on the parameter's list (sme scrren where the Python script is edited) the value:
>> 
>> RR=[['04-03-2001','0900','MEX','PBA','0300','N'],['04-03-2001','1100','MTY','NLD','0300','N'],['04-03-2001','1600','NLD','MTY','0300','N']]
>> 
>> and proceed to TEST the script with the test tab, I am asked for the value of RR (two fields), if I give nothing, then the message
>> 
>> "It is a list" is printed, as expected.
>> 
>> But, if the same thing, (except the initial RR=) is fed into the values field at the test page, then the result comes as a "string", which is NOT the intended effect.
>> 
>> This is just a brief test to find out what is going on, the goal is to be able to feed into a Python script, a list of lists that the script will process
>>   and output another list of lists. We have been unable to obtain this as the scripts always ends getting a string instead of the wanted list (of lists).
>> 
>> Can anyone be so kind to explain the behavior of this ? And, to provide some samples on how to make this work correctly ?
>> 
>> By the way, we started with a perfectly working *.py program file , converting it into a script which behave on a similar way to the test just shown.
>> 
>> Thanks in advance for your help.
>> 
>> Edward.