----- Original Message -----
From: "William Heymann" <[EMAIL PROTECTED]>
Sent: Friday, October 20, 2006 8:55 AM
Subject: [Zope] not allowed to access a particular tuple
This is an external method I wrote to make it easier to iterate over the
records returned from searching the catalog. However if I have
yield record,item instead of yield item it says that I am not allowed to
access a particular tuple during iteration. How can I make it so that the
value that it yields is something that a python script object can iterate
over? I have also tried doing yield tuple((record,item)) yield
list(record,item) and they give the same problem.
How I use the script is pretty much
for record, doc in catalogIter(context.Catalog(searchterms)):
Of course what is inside is different from that but it will cause the same
problem since the issue happens in the iteration not inside the for loop.
"iterate over a catalog safely"
for record in records:
item = record.getObject()
if item is not None:
except (zExceptions.Unauthorized, zExceptions.NotFound, KeyError,
The 'yield' statement is not allowed within a 'try' clause (see the Python
Why don't you just build a simple list (or list of tuples) and return that?
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -