Better check for request null value ZTK-1.1
authorThierry Florac
Sat, 10 Dec 2011 01:32:15 +0100
branchZTK-1.1
changeset 91 9bd1b95afc93
parent 90 c6c504e7fe82
child 92 bf59a3d6e437
Better check for request null value
ztfy/utils/catalog/__init__.py
--- a/ztfy/utils/catalog/__init__.py	Sun Nov 20 12:52:25 2011 +0100
+++ b/ztfy/utils/catalog/__init__.py	Sat Dec 10 01:32:15 2011 +0100
@@ -42,11 +42,11 @@
 def getIntIdUtility(name='', request=None, context=None):
     """Look for a named IIntIds utility"""
     if request is None:
-        request = request_utils.getRequest()
+        request = request_utils.queryRequest()
     intids = request_utils.getRequestData('IntIdsUtility::' + name, request)
     if intids is None:
         intids = queryUtility(IIntIds, name, context=context)
-        if intids is not None:
+        if (request is not None) and (intids is not None):
             request_utils.setRequestData('IntIdsUtility::' + name, intids, request)
     return intids
 
@@ -56,7 +56,7 @@
     if object 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.queryId(object)