# HG changeset patch # User Thierry Florac # Date 1515686178 -3600 # Node ID 9ac65a867f3eae717e2629fbebd38454e924c2b3 # Parent 88f33861b1431fc168bb37e9faf5fd119023d68e Updates in registry management functions diff -r 88f33861b143 -r 9ac65a867f3e src/pyams_utils/registry.py --- a/src/pyams_utils/registry.py Thu Jan 11 16:51:53 2018 +0100 +++ b/src/pyams_utils/registry.py Thu Jan 11 16:56:18 2018 +0100 @@ -38,7 +38,7 @@ # import packages from pyramid.events import subscriber -from pyramid.threadlocal import manager, get_current_registry +from pyramid.threadlocal import manager, get_current_registry as get_request_registry from ZODB.POSException import POSError from zope.component.globalregistry import getGlobalSiteManager from zope.interface import implementedBy, providedBy @@ -101,14 +101,19 @@ yield registry -def get_global_registry(context=None): +def get_current_registry(context=None): """Get current or global registry""" - registry = get_current_registry(context) + registry = get_request_registry(context) if registry is None: registry = getGlobalSiteManager() return registry +def get_global_registry(): + """Get global registry""" + return getGlobalSiteManager() + + def registered_utilities(): """Get utilities registrations as generator