[Zope] Accessing ZSQL result object contents via python:repeat

andrew cooke andrew at acooke.org
Sun Oct 26 16:34:43 EST 2003


Sorry, I don't think I was clear enough.  I need to access the value
within ZPT using the "python:" syntax.

The code is:
         <option tal:repeat="item here/sql/list_projects"
                 tal:content="item/description"
                 tal:attributes="value item/project;selected
python:request.get('project', None) ==
str(repeat['item'].number()) and 'selected' or nothing">

but instead of repeat['item'].number() i want to use the value
item/project.  however, as i said, things like rpeat['item'].project do
not work.

Cheers,
Andrew


Andreas Jung said:

>
> for row in zsqlmethod(someargs):
>    print row.col1
>    print row.col2
>
> -aj
>
> --On Sonntag, 26. Oktober 2003 18:12 Uhr -0300 andrew cooke
> <andrew at acooke.org> wrote:
>
>>
>> I have an ZSQL result, which I am iterating over using tal:repeat.  I
>> can
>> access the column values using tal syntax like item/col1 and item/col2.
>> But how do I access thes values via Python?  I've tried
>> python:repeat['item'].col1, python:repeat['item'].col1(), and
>> python:repeat['item']['col1'], but none of those work.  What's the magic
>> recipe?
>>
>> Thanks,
>> Andrew
>
>
>
>
>


-- 
http://www.acooke.org/andrew



More information about the Zope mailing list