[Zope] Help with unconsistent behavior of parameter passing to Python Scripts.
Dieter Maurer
dieter@handshake.de
Fri, 12 Apr 2002 21:48:36 +0200
febb writes:
> Having the following Python script:
>
> if same_type(RR,[]):
> return "It is a list"
> if same_type(RR,'abcd'):
> return "it is a string"
>
> ... calling "Test" with parameter value "[...]" returns "is a string"...
I think, this is correct behaviour:
Python is not statically typed. The same name can be bound to different
types over time.
The fact, that your argument has a list as default value does
not mean, that all passed in values will be lists.
The parameters passed with any Web request *ARE* all strings
in the first place. Zope uses various ":XXX" suffixes to
the parameter names to control how these strings are converted
into other datatype (see e.g.
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
). But the "Test" interface of "PythonScripts" does not support
these conversion suffixes.
I agree, this is a limitation, but not inconsistent...
Dieter