[Zope-dev] Unexpected Behaviour iterating over catalog search...

Chris Withers chris at simplistix.co.uk
Fri Mar 5 04:44:21 EST 2004


Hi,

I have something like this:

for brain in Catalog(some_index=some_value):
     # delete the object, and then
     Catalog.uncatalog_object(brain.getPath())

...which wasn't deleting all objects where some_index=some_value.

On a hunch, I tried:

for brain in tuple(Catalog(some_index=some_value)):
     # delete the object, and then
     Catalog.uncatalog_object(brain.getPath())

...which magically worked.

Surely the thing returned by a Catalog search should be immutable?

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the Zope-Dev mailing list