[Zope] Re: How to pass arbitrary objects to a ZPT from Script(Python)

Phil Harris phil at harris-family.info
Sat Nov 8 20:19:50 EST 2003


That doesn't half complicate what is a really simple thing.

# script python

context.aaa(a=1,b=2)

# zpt

<span tal:replace="options/a"/>
<span tal:replace="options/b"/>


Bottom line is that any 'parameters' to a zpt are put into the options 
dictionary.

Simple eh?

Phil




--On 08 November 2003 22:45 +0000 Lee Harr <missive at hotmail.com> wrote:

>> My problem is this: How can I, from a python script, pass a result set
>> which has been returned from a ZSQL method, on to a ZPT
>
>
> How about this...
>
># script (python)
> aaa = context.aaa # a zpt
>
> foo = [1, 2, 3, 4, 5] # could be sql result
>
> req = context.REQUEST
> req.set('foo', foo)
>
> return aaa(REQUEST=req)
>###
>
> Then in the zpt:
>
> <span tal:replace="request/foo">foo goes here</span>
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )




More information about the Zope mailing list