From d1f10551abcdba06b20007f20ee9ea68206d3dd6 Mon Sep 17 00:00:00 2001 From: Nicolas Dumazet <nicolas.dumazet@nexedi.com> Date: Mon, 24 May 2010 09:43:10 +0000 Subject: [PATCH] fix TestTemplate.test_NonDeliveryTemplateNotIndexable. Calling directly .unindexObject on a new object is not enough, because some activity might be queued, waiting to reindex that object. The fact that isIndexable is False prevents _new_ reindexing activities to be queued but _not_ already queued activities to go on. In practice, unindexObject was executed immediatly, a commit/tic followed and executed just after a reindex, eventually indexing the object. Queuing the unindexObject call as an SQLQueue activity with an after_path_and_method_id matching the possible reindexing activities on that object is the way to go to avoid that reindexation race. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35553 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Base.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index c13940049c..e0d47ac401 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -3415,7 +3415,11 @@ class Base( CopyContainer, # Make sure this object is not in the catalog catalog = getToolByName(self, 'portal_catalog', None) if catalog is not None: - catalog.unindexObject(self, uid=self.getUid()) + kw = dict(activity="SQLQueue") + kw['after_path_and_method_id']= ([self.getPath(), + ['immediateReindexObject', + 'recursiveImmediateReindexObject']]) + catalog.activate(**kw).unindexObject(uid=self.getUid()) self.isIndexable = ConstantGetter('isIndexable', value=False) self.isTemplate = ConstantGetter('isTemplate', value=True) # XXX reset security here -- 2.30.9