Commit df6fe110 authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Type: Merge activate_kw into reindex_kw before passing to _reindexOnCreation.

_reindexOnCreation API does not expect an expanded activate_kw, but
really only an expanded reindex_kw - which may contain its own
activate_kw, over which our activate_kw is supposed to take precedence
(see Products.ERP5Type.Base.Base._getReindexAndActivateParameterDict).
It's all so easy !
parent da76c997
...@@ -455,10 +455,12 @@ class ERP5TypeInformation(XMLObject, ...@@ -455,10 +455,12 @@ class ERP5TypeInformation(XMLObject,
# - if ImmediateReindexContextManager is used, anything until # - if ImmediateReindexContextManager is used, anything until
# context manager exits. # context manager exits.
method = ob._reindexOnCreation method = ob._reindexOnCreation
if activate_kw is not None:
if reindex_kw is None:
reindex_kw = {}
reindex_kw.setdefault('activate_kw', {}).update(activate_kw)
if reindex_kw is not None: if reindex_kw is not None:
method = partial(method, **reindex_kw) method = partial(method, **reindex_kw)
elif activate_kw is not None:
method = partial(method, **activate_kw)
if isinstance(immediate_reindex, ImmediateReindexContextManager): if isinstance(immediate_reindex, ImmediateReindexContextManager):
immediate_reindex.append(method) immediate_reindex.append(method)
elif immediate_reindex: elif immediate_reindex:
......
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