--- a/src/pyams_utils/request.py Sun Feb 18 12:55:04 2018 +0100
+++ b/src/pyams_utils/request.py Sun Feb 18 17:34:17 2018 +0100
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_utils.registry import get_global_registry
__docformat__ = 'restructuredtext'
@@ -22,6 +21,7 @@
from zope.annotation.interfaces import IAttributeAnnotatable, IAnnotations
# import packages
+from pyams_utils.registry import get_global_registry
from pyramid.request import Request
from pyramid.security import Allowed
from pyramid.threadlocal import get_current_request, get_current_registry
@@ -159,7 +159,7 @@
"""
try:
annotations = request.annotations
- except AttributeError:
+ except (TypeError, AttributeError) as e:
annotations = get_annotations(request)
return annotations.get(key, default)
@@ -173,6 +173,6 @@
"""
try:
annotations = request.annotations
- except AttributeError:
+ except (TypeError, AttributeError) as e:
annotations = get_annotations(request)
annotations[key] = value