Changed registry access
authorThierry Florac <thierry.florac@onf.fr>
Wed, 20 May 2015 12:31:11 +0200
changeset 40 5ff311e24fdf
parent 39 51a07039228f
child 41 905e30f5467b
Changed registry access
src/pyams_security/site.py
--- a/src/pyams_security/site.py	Wed May 20 12:30:55 2015 +0200
+++ b/src/pyams_security/site.py	Wed May 20 12:31:11 2015 +0200
@@ -25,9 +25,9 @@
 from pyams_security.plugin.admin import AdminAuthenticationPlugin
 from pyams_security.utility import SecurityManager
 from pyams_utils.registry import utility_config
-from pyams_utils.request import check_request
 from pyams_utils.site import check_required_utilities
 from pyramid.events import subscriber
+from pyramid.threadlocal import get_current_registry
 from zope.lifecycleevent import ObjectCreatedEvent
 
 
@@ -60,7 +60,6 @@
     admin_auth.title = 'System manager authentication'
     admin_auth.login = 'admin'
     admin_auth.password = 'admin'
-    request = check_request()
-    request.registry.notify(ObjectCreatedEvent(admin_auth))
+    get_current_registry().notify(ObjectCreatedEvent(admin_auth))
     utility = event.object
     utility['__system__'] = admin_auth