Robert Sirois wrote:
> Hey, how do I get multiple variables from a script to use on a ZPT?
>
> ie. Script:
>
> a = 'yo'
>
> b = ' wuzzup'
>
> c = []
>
> c.append(a)
>
> c.append(b)
>
> return c
>
> I can get a list to print out on the page, but how could I use each one
> separately?
Well, let me point out in fact you return only one variable :-)
(And btw, you can construct lists much easier - no need for
a, b and append() :-)
To have easy access to a lot of names throughout your ZPT,
the usual pattern is to call your ZPT from controller
python script.
Like this:
a='yo'
b='wuzzup'
return context.yourZPT(a=a,b=b)
and in your ZPT you access the values simply by:
options/a and options/b
this can be extended by using arbitrary nested dictionaries
(and lists for loops)
a=dict(name='peter',age=25)
return context.yourZPT(a=a) # left hand 'a' is the name you use
# inside ZPT of course
and inside ZPT: options/a/name options/a/age
Regards
Tino Wildenhain
_______________________________________________
ZPT mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zpt