[Zope] Iteration over columns in ZSQLMethod result not working in Zope 2.12.13
Andreas Elvers
andreas at work.de
Tue Dec 7 07:15:04 EST 2010
Hi Tres,
[...]
>> Given some ZSQLMethod, and either ZMySQLDA (3.1.1) or ZPsycopgDA
>> (2.0.14 or 2.2.2)
>> and the following python script:
>>
>> result = context.someZSQLMethod()
>> for row in result:
>> for col in row: #this will fail
>> pass
>>
>> I get an AttributeError: __iter__
[...]
> I don't think the Record class fills the 'tp_iter' slot. [...]
I don't know about this tp_iter slot, but adding the following
DocTest to the Record tests.py will pass:
def test_RecordIteration():
"""
Creating a record
>>> r = P(('zx', 81 , 1.23))
We can iterate over a record:
>>> [i for i in r]
['zx', 81, 1.23]
"""
- Andreas
More information about the Zope
mailing list