[Checkins] SVN: z3c.relationfield/trunk/src/z3c/relationfield/event.py Fix a bug involving bucket size changes; we were deleting relations from

Martijn Faassen faassen at infrae.com
Thu Jan 8 11:37:10 EST 2009


Log message for revision 94630:
  Fix a bug involving bucket size changes; we were deleting relations from
  the catalog during a query (due to the use fo a generator) and that didn't
  work.
  

Changed:
  U   z3c.relationfield/trunk/src/z3c/relationfield/event.py

-=-
Modified: z3c.relationfield/trunk/src/z3c/relationfield/event.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/event.py	2009-01-08 16:36:22 UTC (rev 94629)
+++ z3c.relationfield/trunk/src/z3c/relationfield/event.py	2009-01-08 16:37:10 UTC (rev 94630)
@@ -44,8 +44,11 @@
     intids = component.getUtility(IIntIds)
 
     # remove previous relations coming from id (now have been overwritten)
-    for relation in catalog.findRelations({'from_id': intids.getId(obj)}):
-        catalog.unindex(relation)    
+    # have to activate query here with list() before unindexing them so we don't
+    # get errors involving buckets changing size
+    rels = list(catalog.findRelations({'from_id': intids.getId(obj)}))
+    for rel in rels:
+        catalog.unindex(rel)    
 
     # add new relations
     addRelations(obj, event)



More information about the Checkins mailing list