Commit c402e74c authored by Jean-Paul Smets's avatar Jean-Paul Smets

now uses insert_catalog_line


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@930 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b1353009
......@@ -282,6 +282,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Generate UID
kw['path'] = path
kw['uid'] = int(index)
kw['insert_catalog_line'] = insert_catalog_line
# LOG
# LOG("Call SQL Method %s with args:" % method_name,0, str(kw))
# Alter row
......@@ -294,17 +295,23 @@ class Catalog(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
if self.hasUid(uid):
catalog_path = self.getPathForUid(uid)
if catalog_path == "reserved":
# Reserved line in catalog table
insert_catalog_line = 0
elif catalog_path is None:
# No line in catalog table
insert_catalog_line = 1
else:
LOG('SQLCatalog WARNING',0,'assigning new uid to already catalogued object %s' % path)
uid = 0
insert_catalog_line = 0
if not uid:
# Generate UID
index = self.newUid()
object.uid = index
else:
index = uid
for method_name in self.sql_catalog_object:
# We will check if there is an filter on this
# method, if so we may not call this zsqlMethod
......@@ -342,6 +349,7 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
# Generate UID
kw['path'] = path
kw['uid'] = index
kw['insert_catalog_line'] = insert_catalog_line
# LOG
# LOG("Call SQL Method %s with args:" % method_name,0, str(kw))
# Alter row
......@@ -436,12 +444,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
LOG("Warning: could not find path from uid",0,str(uid))
return None
def hasUid(self, uid):
""" Checks if uid is catalogued for a real object """
path = self.getPathForUid(uid)
if path is None: return 0
return path != 'reserved'
def getMetadataForUid(self, uid):
""" Accesses a single record for a given uid """
if uid is None:
......
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