Commit 35c38086 authored by Vincent Pelletier's avatar Vincent Pelletier

CopySupport: Add support for reindex_kw.

Consistently with other methods which may trigger reindexations.
parent ba0fd479
...@@ -422,15 +422,16 @@ class CopyContainer: ...@@ -422,15 +422,16 @@ class CopyContainer:
path_item_list=previous_path, path_item_list=previous_path,
new_id=self.id) new_id=self.id)
def _duplicate(self, cp): def _duplicate(self, cp, reindex_kw=None):
_, result = self.__duplicate( _, result = self.__duplicate(
cp, cp,
duplicate=True, duplicate=True,
is_indexable=None, is_indexable=None,
reindex_kw=reindex_kw,
) )
return result return result
def __duplicate(self, cp, duplicate, is_indexable): def __duplicate(self, cp, duplicate, is_indexable, reindex_kw):
try: try:
cp = _cb_decode(cp) cp = _cb_decode(cp)
except: except:
...@@ -490,6 +491,8 @@ class CopyContainer: ...@@ -490,6 +491,8 @@ class CopyContainer:
new_id = self._get_id(orig_id) new_id = self._get_id(orig_id)
result.append({'id': orig_id, 'new_id': new_id}) result.append({'id': orig_id, 'new_id': new_id})
new_ob._setId(new_id) new_ob._setId(new_id)
if reindex_kw is not None:
new_ob.setDefaultReindexParameterDict(reindex_kw)
if is_indexable is not None and not is_indexable: if is_indexable is not None and not is_indexable:
new_ob._setNonIndexable() new_ob._setNonIndexable()
self._setObject(new_id, new_ob, set_owner=set_owner) self._setObject(new_id, new_ob, set_owner=set_owner)
...@@ -531,7 +534,7 @@ class CopyContainer: ...@@ -531,7 +534,7 @@ class CopyContainer:
self.isIndexable = ConstantGetter('isIndexable', value=False) self.isIndexable = ConstantGetter('isIndexable', value=False)
self.__recurse('_setNonIndexable') self.__recurse('_setNonIndexable')
def manage_pasteObjects(self, cb_copy_data=None, is_indexable=None, REQUEST=None): def manage_pasteObjects(self, cb_copy_data=None, is_indexable=None, reindex_kw=None, REQUEST=None):
"""Paste previously copied objects into the current object. """Paste previously copied objects into the current object.
If calling manage_pasteObjects from python code, pass the result of a If calling manage_pasteObjects from python code, pass the result of a
...@@ -552,6 +555,7 @@ class CopyContainer: ...@@ -552,6 +555,7 @@ class CopyContainer:
cp, cp,
duplicate=False, duplicate=False,
is_indexable=is_indexable, is_indexable=is_indexable,
reindex_kw=reindex_kw,
) )
if REQUEST is None: if REQUEST is None:
return result return result
......
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