[Zope] Great How-To on using ZSQL methods from an External method

David C. Morrill dmorrill@austin.rr.com
Tue, 2 Nov 1999 14:35:19 -0600


> Don't forget that you can call a field directly by both getitem and
> getattr:
>
> res=someSqlMethod(name='bob', relation='uncle')
>
> for r in res:
>    #loop through the result set, r is a Record object
>    if r.age < 12:
>      #do something for young uncles here
>    else:
>      #do something else for everyone older.
>
> AGE is a column in the results set.  There's a lot of meta-data in
> Record objects that can generally be avoided in common programming.

Great!!! That makes life much easier. Thanks for the tip (I hope the How-To
author sees this tip also)...

Dave Morrill