[ZPatterns] simple python script <-> skinscript interaction question

Phillip J. Eby pje@telecommunity.com
Sat, 28 Dec 2002 14:37:12 -0500


At 03:23 PM 12/27/02 -0800, Rob Miller wrote:
>Hi there,
>
>I'm currently a bit stumped by what I think is a very simple issue.  I'm 
>populating the attributes of a DataSkin object using both ZSQL Methods and 
>Python Scripts that are in the corresponding Rack.  I can populate several 
>attibutes at one time by using a ZSQL Method and the "WITH QUERY 
>sql_methodname COMPUTE attr1, attr2, attr3" SkinScript idiom.  I can also 
>populate a single attribute by using a Python Script and the "WITH 
>py_methodname COMPUTE attr4=RESULT" SkinScript idiom.
>
>What I can't do, however, is figure out how to return several attributes 
>at once using Python Scripts.  I've tried returning dictionaries, I've 
>tried return namespaces (i.e. using Zope's "_(dictionary)" syntax), I've 
>tried every combination conceivable of using (or not) the "QUERY" modifier 
>in the SkinScript statement, but I can't seem to get it to work, nor can I 
>find anything enlightening in docs or mailing list archive.
>
>Can someone tell me what I need to do to get "WITH py_methodname COMPUTER 
>attr1, attr2, attr3" to work?
>
>thanks!

You need to return an object that has the appropriate attributes.  That 
means you need a class.  I don't know if you can do that in Python Scripts 
or not.