Changed registry access
authorThierry Florac <thierry.florac@onf.fr>
Wed, 20 May 2015 12:22:57 +0200
changeset 10 5f15771e74b3
parent 9 4c1ae5583036
child 11 ee5900572943
Changed registry access
src/pyams_file/thumbnail.py
--- a/src/pyams_file/thumbnail.py	Fri Mar 20 23:21:06 2015 +0100
+++ b/src/pyams_file/thumbnail.py	Wed May 20 12:22:57 2015 +0200
@@ -29,8 +29,8 @@
 from pyams_utils.adapter import ContextAdapter, ContextRequestViewAdapter, adapter_config
 from pyams_utils.request import check_request
 from pyramid.events import subscriber
-from zope.component import adapter
-from zope.interface import implementer, Interface
+from pyramid.threadlocal import get_current_registry
+from zope.interface import Interface
 from zope.lifecycleevent import ObjectAddedEvent, ObjectRemovedEvent, ObjectCreatedEvent
 from zope.location import locate
 
@@ -152,7 +152,7 @@
                 thumbnailer_name = thumbnail_name
             options = name = thumbnail_name
         # generate and store thumbnail
-        registry = check_request().registry
+        registry = get_current_registry()
         thumbnailer = registry.queryAdapter(self.image, IThumbnailer, name=thumbnailer_name)
         if thumbnailer is not None:
             thumbnail_image = thumbnailer.create_thumbnail(options, format)