[Zope] passing lists as function parameters
AM
list_subscriber@neurobs.com
Fri, 08 Nov 2002 11:14:30 -0800
If you are using the test tab in the mangage scripts section, AFAIK the
arguments are sent in as part of the REQUEST, and in REQUEST unless the
form variable names have a :list at the end, Zope will not treat them as
lists.
In general when you use the test tab I have observed that the arguments
are passed in as strings.
While testing Python Scripts that take in lists or other such stuff, I
usually test them using a DTML method or such.
HTH
AM
Eric Roby wrote:
>Maybe I am really missing something here, but for some time, I have been
>trying to figure out why when I pass a list to a python script, it
>becomes a sequence of characters. When I duplicate the process within
>the interpreter, it works as I expect it to. An example to demonstrate
>what I am talking about:
>
>Interpreter test-
>
>
>>>>listDef = [1,2,3,4,5]
>>>>def foo(x):
>>>>
>>>>
>... for member in x:
>.... print member
>...
>
>
>>>>foo(listDef)
>>>>
>>>>
>1
>2
>3
>4
>5
>
>
>
>In Zope, if I create the equivalent of the foo function in a python
>script, passing a list in the parameter field, I get the following:
>1
>,
>2
>,
>3
>,
>4
>,
>5
>
>Or if I test the script with the following value for the parameter -
>[1,2,3,4,5] - I get:
>[
>1
>,
>2
>,
>3
>,
>4
>,
>5
>,
>]
>so ... len(theList) returns a value that represents the count of all
>characters in the list definition - not the number of items in the list.
>
>Any enlightenment here would be greatly appreciated. I hesitate to call
>'BUG' cause it might be me that is 'buggy'...
>
>TIA
>
>Eric
>
>
>_______________________________________________
>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 )
>
>
>
>
--
==================================================================
Aseem Mohanty
Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706
(R) 510 7696011 (M) 510 3014871 (O) 510 5279231
==================================================================
"I saw `cout' being shifted "Hello world" times to the left and
stopped right there!!" -- Steve Gonedes
==================================================================