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): ...@@ -115,7 +115,7 @@ class Inventory(Delivery):
self.portal_catalog.catalogObjectList(object_list) self.portal_catalog.catalogObjectList(object_list)
self.portal_catalog.catalogObjectList(stock_object_list, self.portal_catalog.catalogObjectList(stock_object_list,
method_id_list=('z_catalog_stock_list',), method_id_list=('z_catalog_stock_list',),
disable_cache=1,allow_duplicate_uid=1) disable_cache=1,check_uid=0)
security.declarePublic( 'recursiveReindexObject' ) security.declarePublic( 'recursiveReindexObject' )
def recursiveReindexObject(self, *args, **kw): def recursiveReindexObject(self, *args, **kw):
......
...@@ -938,7 +938,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -938,7 +938,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
self.catalogObjectList([object]) self.catalogObjectList([object])
def catalogObjectList(self, object_list, method_id_list=None, disable_cache=0, 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 Add objects to the Catalog by calling
all SQL methods and providing needed arguments. all SQL methods and providing needed arguments.
...@@ -980,7 +980,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -980,7 +980,7 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
raise raise
except: except:
raise RuntimeError, 'could not set missing uid for %r' % (object,) raise RuntimeError, 'could not set missing uid for %r' % (object,)
else: elif check_uid:
uid = object.uid uid = object.uid
path = object.getPath() path = object.getPath()
index = self.getUidForPath(path) index = self.getUidForPath(path)
...@@ -999,8 +999,6 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -999,8 +999,6 @@ 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 # 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 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 # 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)) #LOG('catalogObject', 0, 'uid = %r, catalog_path = %r' % (uid, catalog_path))
if catalog_path == "reserved": if catalog_path == "reserved":
......
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