Commit d1f10551 authored by Nicolas Dumazet's avatar Nicolas Dumazet

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
parent 37eaef2e
...@@ -3415,7 +3415,11 @@ class Base( CopyContainer, ...@@ -3415,7 +3415,11 @@ class Base( CopyContainer,
# Make sure this object is not in the catalog # Make sure this object is not in the catalog
catalog = getToolByName(self, 'portal_catalog', None) catalog = getToolByName(self, 'portal_catalog', None)
if catalog is not 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.isIndexable = ConstantGetter('isIndexable', value=False)
self.isTemplate = ConstantGetter('isTemplate', value=True) self.isTemplate = ConstantGetter('isTemplate', value=True)
# XXX reset security here # XXX reset security here
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment