[Erp5-report] r35553 nicolas.dumazet - /erp5/trunk/products/ERP5Type/Base.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon May 24 11:43:11 CEST 2010
Author: nicolas.dumazet
Date: Mon May 24 11:43:10 2010
New Revision: 35553
URL: http://svn.erp5.org?rev=35553&view=rev
Log:
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.
Modified:
erp5/trunk/products/ERP5Type/Base.py
Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=35553&r1=35552&r2=35553&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Mon May 24 11:43:10 2010
@@ -3415,7 +3415,11 @@
# 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
More information about the Erp5-report
mailing list