[Zope] not allowed to access a particular tuple

William Heymann kosh at aesaeion.com
Fri Oct 20 09:34:51 EDT 2006

On Friday 20 October 2006 07:05, Jonathan wrote:

> The 'yield' statement is not allowed within a 'try' clause (see the Python
> Reference manual).

Hmm that seems strange, it works just fine in all the places I have done it, 
the only issue is zope not liking the returned object if it is not a single 
item. When it is reading over records it is raising exceptions in the calls 
to getObject() sometimes and on all the tests it just does not return those 
objects which is exactly what it should do.


According to those docs you can't use yield inside a try finally not a try 

> Why don't you just build a simple list (or list of tuples) and return that?

I wanted to use yield because records from a Catalog is already lazy and I did 
not want to load a bunch of objects into ram that I did not need to, that is 
why I did not return a list.

> Jonathan

More information about the Zope mailing list