Modified handling of 'catalog_name' parameter to allow function to use a catalog as well as a catalog name
--- a/ztfy/utils/catalog.py Mon Sep 14 23:47:12 2009 +0200
+++ b/ztfy/utils/catalog.py Tue Sep 29 22:35:14 2009 +0200
@@ -86,7 +86,10 @@
request = request_utils.getRequest()
intids = getIntIdUtility('', request, context)
if intids is not None:
- catalog = queryCatalog(catalog_name, context)
+ if ICatalog.providedBy(catalog_name):
+ catalog = catalog_name
+ else:
+ catalog = queryCatalog(catalog_name, context)
if catalog is not None:
id = intids.register(object)
if index_name:
@@ -103,7 +106,10 @@
request = request_utils.getRequest()
id = getObjectId(object, '', request, context)
if id is not None:
- catalog = queryCatalog(catalog_name, context)
+ if ICatalog.providedBy(catalog_name):
+ catalog = catalog_name
+ else:
+ catalog = queryCatalog(catalog_name, context)
if catalog is not None:
if index_name:
catalog[index_name].unindex_doc(id)