Chris Withers wrote:

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?

Nope, it is "lazy"; immutability would require "realizing" it first, which would be prohibitively expensive in many cases. Wrapping 'list()' around the result set would've worked, too.


Tres.
--
===============================================================
Tres Seaver                                [EMAIL PROTECTED]
Zope Corporation      "Zope Dealers"       http://www.zope.com


_______________________________________________
Zope-Dev maillist - [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to