Get current registry from threadlocal manager
authorThierry Florac <thierry.florac@onf.fr>
Tue, 17 Mar 2015 17:12:48 +0100
changeset 3 5ee5bf0d8c45
parent 2 2cbea3d9e537
child 4 4070bf0c5d9e
Get current registry from threadlocal manager
src/pyams_file/property.py
--- a/src/pyams_file/property.py	Tue Mar 17 17:12:22 2015 +0100
+++ b/src/pyams_file/property.py	Tue Mar 17 17:12:48 2015 +0100
@@ -23,7 +23,7 @@
 
 # import packages
 from pyams_file.file import FileFactory
-from pyams_utils.request import check_request
+from pyramid.threadlocal import get_current_registry
 from zope.interface import alsoProvides
 from zope.lifecycleevent import ObjectCreatedEvent, ObjectRemovedEvent, ObjectAddedEvent
 from zope.location.location import locate
@@ -61,7 +61,7 @@
     def __set__(self, instance, value):
         if value is NOT_CHANGED:
             return
-        registry = check_request().registry
+        registry = get_current_registry()
         if (value is not None) and (value is not DELETED_FILE):
             filename = None
             # file upload data converter returns a tuple containing