Commit c8630963 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Disable implicit indexing of a new object in the document constructor, so that...

Disable implicit indexing of a new object in the document constructor, so that activate_kw be passed to every activate call correctly.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13780 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e23e16c0
......@@ -332,15 +332,24 @@ class DocumentConstructor(Method):
def __call__(self, folder, id, REQUEST=None,
activate_kw=None, is_indexable=None, **kw):
o = self.klass(id)
if activate_kw is not None:
o.setDefaultActivateParameters(**activate_kw)
# Disable implicit indexing, because activate_kw may not be
# set correctly, as setDefaultActivateParameters depends on
# the physical path, until it is connected to an object tree.
o.isIndexable = 0
folder._setObject(id, o)
if is_indexable is not None:
o.isIndexable = is_indexable
folder._setObject(id, o)
else:
del o.isIndexable
o = folder._getOb(id)
if activate_kw is not None:
o.setDefaultActivateParameters(**activate_kw)
# Now execute reindexObject explicitly.
o.reindexObject()
# if no activity tool, the object has already an uid
if getattr(aq_base(o),' uid', None) is None:
o.uid = folder.portal_catalog.newUid()
if kw: o.__of__(folder)._edit(force_update=1, **kw)
if kw: o._edit(force_update=1, **kw)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect( 'manage_main' )
......
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