Commit 91c85f24 authored by Sebastien Robin's avatar Sebastien Robin

change the way to allow duplicates


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5003 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3f127a96
......@@ -115,7 +115,7 @@ class Inventory(Delivery):
self.portal_catalog.catalogObjectList(object_list)
self.portal_catalog.catalogObjectList(stock_object_list,
method_id_list=('z_catalog_stock_list',),
disable_cache=1,allow_duplicate_uid=1)
disable_cache=1,check_uid=0)
security.declarePublic( 'recursiveReindexObject' )
def recursiveReindexObject(self, *args, **kw):
......
......@@ -938,7 +938,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
self.catalogObjectList([object])
def catalogObjectList(self, object_list, method_id_list=None, disable_cache=0,
allow_duplicate_uid=0):
check_uid=1):
"""
Add objects to the Catalog by calling
all SQL methods and providing needed arguments.
......@@ -980,7 +980,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
raise
except:
raise RuntimeError, 'could not set missing uid for %r' % (object,)
else:
elif check_uid:
uid = object.uid
path = object.getPath()
index = self.getUidForPath(path)
......@@ -999,9 +999,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Make sure no duplicates - ie. if an object with different path has same uid, we need a new uid
# This can be very dangerous with relations stored in a category table (CMFCategory)
# This is why we recommend completely reindexing subobjects after any change of id
catalog_path = None
if not allow_duplicate_uid:
catalog_path = self.getPathForUid(uid)
catalog_path = self.getPathForUid(uid)
#LOG('catalogObject', 0, 'uid = %r, catalog_path = %r' % (uid, catalog_path))
if catalog_path == "reserved":
# Reserved line in catalog table
......
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