Updates in registry management functions
authorThierry Florac <thierry.florac@onf.fr>
Thu, 11 Jan 2018 16:56:18 +0100
changeset 123 9ac65a867f3e
parent 122 88f33861b143
child 124 53dc81f933ed
Updates in registry management functions
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