Check "None" values in getObject and getObjectId functions
authorThierry Florac <tflorac@ulthar.net>
Wed, 10 Nov 2010 07:34:24 +0100
changeset 65 c262ddb4d656
parent 64 a4367f6969e8
child 66 cff370b82f25
Check "None" values in getObject and getObjectId functions
ztfy/utils/catalog/__init__.py
--- a/ztfy/utils/catalog/__init__.py	Wed Sep 08 07:47:20 2010 +0200
+++ b/ztfy/utils/catalog/__init__.py	Wed Nov 10 07:34:24 2010 +0100
@@ -53,6 +53,8 @@
 
 def getObjectId(object, intids_name='', request=None, context=None):
     """Look for an object Id as recorded by given IIntIds utility"""
+    if object is None:
+        return None
     if request is None:
         request = request_utils.getRequest()
     intids = getIntIdUtility(intids_name, request, context)
@@ -63,6 +65,8 @@
 
 def getObject(id, intids_name='', request=None, context=None):
     """Look for an object recorded by given IIntIds utility and id"""
+    if id is None:
+        return None
     if request is None:
         request = request_utils.getRequest()
     intids = getIntIdUtility(intids_name, request, context)