Commit 27c2824e authored by Yoshinori Okuji's avatar Yoshinori Okuji

Use catalogObjectList from catalog_object. Define catalogObjectList. Remove unused methods.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3794 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c1f5c0c5
...@@ -604,52 +604,44 @@ class ZCatalog(Folder, Persistent, Implicit): ...@@ -604,52 +604,44 @@ class ZCatalog(Folder, Persistent, Implicit):
def catalog_object(self, obj, url=None, idxs=[], is_object_moved=0, sql_catalog_id=None): def catalog_object(self, obj, url=None, idxs=[], is_object_moved=0, sql_catalog_id=None):
""" wrapper around catalog """ """ wrapper around catalog """
self.catalogObjectList([obj], sql_catalog_id=sql_catalog_id)
if url is None: def catalogObjectList(self, object_list, sql_catalog_id=None):
try: url = obj.getPhysicalPath """Catalog a list of objects.
except AttributeError: """
raise CatalogError( hot_reindexing = 0
"A cataloged object must support the 'getPhysicalPath' " if self.hot_reindexing_state is not None and self.source_sql_catalog_id == catalog.id:
"method if no unique id is provided when cataloging" hot_reindexing = 1
)
else: url=string.join(url(), '/') wrapped_object_list = []
elif not isinstance(url, types.StringType): url_list = []
raise CatalogError('The object unique id must be a string.') for obj in object_list:
if hot_reindexing:
obj = self.wrapObject(obj, sql_catalog_id=sql_catalog_id) try:
url = obj.getPhysicalPath
except AttributeError:
raise CatalogError(
"A cataloged object must support the 'getPhysicalPath' "
"method if no unique id is provided when cataloging"
)
url = string.join(url(), '/')
url_list.append(url)
obj = self.wrapObject(obj, sql_catalog_id=sql_catalog_id)
wrapped_object_list.append(obj)
catalog = self.getSQLCatalog(sql_catalog_id) catalog = self.getSQLCatalog(sql_catalog_id)
if catalog is not None: if catalog is not None:
#LOG('ZSQLCatalog.catalog_object, object:',0,obj.getPhysicalPath()) catalog.catalogObjectList(wrapped_object_list)
catalog.catalogObject(obj, url, is_object_moved=is_object_moved) # support obj, not uid
#catalog.reindexObject(obj, is_object_moved=is_object_moved) # support obj, not uid
if self.hot_reindexing_state is not None and self.source_sql_catalog_id == catalog.id: if hot_reindexing:
destination_catalog = self.getSQLCatalog(self.destination_sql_catalog_id) destination_catalog = self.getSQLCatalog(self.destination_sql_catalog_id)
if self.hot_reindexing_state == 'recording': if self.hot_reindexing_state == 'recording':
destination_catalog.recordCatalogObject(url) destination_catalog.recordCatalogObjectList(url_list)
else: else:
destination_catalog.deleteRecordedObjectList([url]) # Prevent this object from being replayed. destination_catalog.deleteRecordedObjectList(url_list) # Prevent this object from being replayed.
#LOG('ZSQLCatalog.catalog_object, and hot reindex : object:',0,obj.getPhysicalPath()) destination_catalog.catalogObjectList(wrapped_object_list)
destination_catalog.catalogObject(obj, url, is_object_moved=is_object_moved)
security.declarePrivate('queueCataloggedObject')
def queueCataloggedObject(self, object, sql_catalog_id=None, *args, **kw):
"""
Add an object into the queue for catalogging the object later in a batch form.
"""
catalog = self.getSQLCatalog(sql_catalog_id)
if catalog is not None:
catalog.queueCataloggedObject(object, **kw)
security.declarePublic('flushQueuedObjectList')
def flushQueuedObjectList(self, sql_catalog_id=None, *args, **kw):
"""
Flush queued objects.
"""
catalog = self.getSQLCatalog(sql_catalog_id)
if catalog is not None:
catalog.flushQueuedObjectList(object, *args, **kw)
def uncatalog_object(self, uid, sql_catalog_id=None): def uncatalog_object(self, uid, sql_catalog_id=None):
""" wrapper around catalog """ """ wrapper around catalog """
......
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