Added handling of runtime exception ZTK-1.1
authorThierry Florac
Mon, 05 Mar 2012 08:27:00 +0100
branchZTK-1.1
changeset 114 2a06052933cb
parent 113 6e4902ab865f
child 115 4ec3baf668c2
Added handling of runtime exception
ztfy/utils/request.py
--- a/ztfy/utils/request.py	Sat Feb 04 09:25:21 2012 +0100
+++ b/ztfy/utils/request.py	Mon Mar 05 08:27:00 2012 +0100
@@ -17,8 +17,9 @@
 # import standard packages
 
 # import Zope3 interfaces
+from zope.annotation.interfaces import IAnnotations
 from zope.publisher.interfaces import IRequest
-from zope.annotation.interfaces import IAnnotations
+from zope.security.interfaces import NoInteraction
 
 # import local interfaces
 
@@ -28,7 +29,6 @@
 # import local packages
 
 from ztfy.utils import _
-from zope.security.interfaces import NoInteraction
 
 
 def getRequest():
@@ -43,7 +43,9 @@
 def queryRequest():
     try:
         return getRequest()
-    except NoInteraction:
+    except NoInteraction:  # No current interaction
+        return None
+    except RuntimeError:   # No request in interaction
         return None