[Zope] parameters from dtml to python
Dieter Maurer
dieter@handshake.de
Mon, 18 Nov 2002 19:38:04 +0100
Jorg E. R=F8dsj=F8 writes:
> I have an external method(python):
>=20
> def makePhoneList(searchString, *sortBy):
>=20
> Then I want to be able to call it in a dtml-document like so (wrong, I
> know, but to illustrate what I am looing for).
>=20
> <dtml-in expr=3D"makePhoneList(searchString=3D'foo', '<dtml-var sortBy=
1>', '<dtml-var sortBy2>')">
>=20
> The sortBy1 and sortBy2 are variables in the DTML-document.
<dtml-in expr=3D"makePhoneList(searchString=3D'foo', sortBy1, sortBy2=
)">
will be fine.
=20
> But I am having problems with the arguments. Possibly due to the fact =
that
> my function specifies *sortBy as a list of parameters.
Probably not.
"*sortBy" in your function definition accepts a (potentially empty)
sequence of values.
"sortBy" is a tuple in your function.
> Any suggestions would be appreciated.
You, probably, should think about some background reading (Zope Book,
Python documentation).
Dieter