--- a/src/ztfy/utils/catalog/__init__.py Mon Oct 07 11:02:07 2013 +0200
+++ b/src/ztfy/utils/catalog/__init__.py Mon Oct 07 11:47:54 2013 +0200
@@ -27,7 +27,7 @@
# import local interfaces
# import Zope3 packages
-from zope.component import queryUtility, getAllUtilitiesRegisteredFor
+from zope.component import queryUtility, getUtility, getAllUtilitiesRegisteredFor
# import local packages
from ztfy.utils import request as request_utils
@@ -39,9 +39,9 @@
def getIntIdUtility(name='', request=None, context=None):
"""Look for a named IIntIds utility"""
+ intids = None
if request is None:
request = request_utils.queryRequest()
- intids = None
if request is not None:
intids = request_utils.getRequestData('IntIdsUtility::' + name, request)
if intids is None:
@@ -68,7 +68,7 @@
if id is None:
return None
if request is None:
- request = request_utils.getRequest()
+ request = request_utils.queryRequest()
intids = getIntIdUtility(intids_name, request, context)
if intids is not None:
return intids.queryObject(id)
@@ -84,11 +84,12 @@
return queryUtility(ICatalog, name, context=context)
-def indexObject(object, catalog_name='', index_name='', request=None, context=None):
+def indexObject(object, catalog_name='', index_name='', request=None, context=None, intids=None):
"""Index object into a registered catalog"""
- if request is None:
- request = request_utils.getRequest()
- intids = getIntIdUtility('', request, context)
+ if intids is None:
+ if request is None:
+ request = request_utils.queryRequest()
+ intids = getIntIdUtility('', request, context)
if intids is not None:
if ICatalog.providedBy(catalog_name):
catalog = catalog_name
--- a/src/ztfy/utils/catalog/configure.zcml Mon Oct 07 11:02:07 2013 +0200
+++ b/src/ztfy/utils/catalog/configure.zcml Mon Oct 07 11:47:54 2013 +0200
@@ -13,4 +13,4 @@
permission="zope.View" />
</class>
-</configure>
\ No newline at end of file
+</configure>