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

David C. Morrill dmorrill@austin.rr.com
Tue, 2 Nov 1999 11:53:58 -0600

I attempted to send the following directly to the author of the subject
How-To, but the mail bounced, so I thought I might post it here, just in
case he might see it...

I just wanted to thank you for posting your How-To on accessing a ZSQL
Method from an External Method. I had just gotten to the point in my project
where I needed to do just that, and was scratching my head wondering how to
do it. I finally decided to take a look through the Zope site How-To's and
ran across yours. It was exactly the information I was looking for, and very
clearly written. Thank you very much! I'm sure it has saved me hours and
hours of frustration poring through the Zope docs trying to figure it out.

I'm still fairly new to Python, but the only part of your How-To that, IMHO,
might be written a little more simply is the code fragment in the "What is
res?" section:

    for i in range(len(fieldnames)):

which might read more clearly as:

    fields2index = {}
    for name, index in res._schema.items():
        fields2index[ name ] = index

Just a suggestion. In any case, thanks again for posting your "lifesaver"

Dave Morrill