--- a/src/pyams_utils/registry.py Tue Nov 08 12:22:05 2016 +0100
+++ b/src/pyams_utils/registry.py Tue Nov 08 12:23:11 2016 +0100
@@ -28,6 +28,7 @@
# import packages
from pyramid.events import subscriber
from pyramid.threadlocal import manager
+from ZODB.POSException import POSError
from zope.interface import implementedBy, providedBy
@@ -86,10 +87,13 @@
def query_utility(provided, name='', default=None):
"""Query utility registered with given interface"""
- for registry in get_registries():
- utility = registry.queryUtility(provided, name, default)
- if utility is not None:
- return utility
+ try:
+ for registry in get_registries():
+ utility = registry.queryUtility(provided, name, default)
+ if utility is not None:
+ return utility
+ except POSError:
+ pass
return default