[Zope] Re: feed ZSQL "select" to a multiple selection property

Daniel Ajoy dajoy at openworldlearning.org
Tue Sep 2 20:09:11 EDT 2003


Thanks to both. It worked.

But now I curious if there is a need to have the ZSQL
method at all, or if there is a way to query the database
directly from within the script.

thanks again,
Daniel



On 2 Sep 2003 at 20:24, Dieter Maurer wrote:

> Daniel Ajoy wrote at 2003-8-28 18:08 -0500:
>  > How can I feed a ZSQL "select" to a multiple 
>  > selection property?
> 
> You can use "Formulator" or use an adapter (a Python Script)
> to your Z SQL Method.
> 
> The adapter would look like this:
> 
>     return [r[0] for r in context.<yourZSQLMethod>()]
> 
> 
> Dieter
> 


From: Dustin Mitchell <dustin at ywlcs.org>

> Subject: Re: [Zope] feed ZSQL "select" to a multiple selection
> 	property
> To: zope at zope.org
> Message-ID: <20030901230748.GX17963 at eleanor.internal.ywlcs.org>
> Content-Type: text/plain; charset=us-ascii
> 
> Use an SQL query as below, then call it from a Python script, located
> within acquisition context, such as
> 
> ---
> rv = []
> for row in old_zsql_method:
>   rv.append(row.field1)
> return rv
> ---
> 
> Then give the name of your Python script as the default value of the
> "multiple" property.
> 
> Dustin




More information about the Zope mailing list