Updated "pagelet_config" decorator
authorThierry Florac <tflorac@ulthar.net>
Sat, 09 Jun 2018 00:45:28 +0200
changeset 7 1cfafd51022f
parent 6 c6d670ac9d83
child 8 a224fe9eda03
Updated "pagelet_config" decorator
src/pyams_pagelet/pagelet.py
--- a/src/pyams_pagelet/pagelet.py	Sat Jan 27 00:41:01 2018 +0100
+++ b/src/pyams_pagelet/pagelet.py	Sat Jun 09 00:45:28 2018 +0200
@@ -127,15 +127,17 @@
         depth = settings.pop('_depth', 0)
 
         def callback(context, name, ob):
-            cdict = {}
-            cdict['__name__'] = settings.get('name')
-            cdict['permission'] = settings.get('permission')
+            cdict = {
+                '__name__': settings.get('name'),
+                '__module__': ob.__module__,
+                'permission': settings.get('permission')
+            }
             new_class = type(ob.__name__, (ob, Pagelet), cdict)
 
             config = context.config.with_package(info.module)
             logger.debug('Registering pagelet view "{0}" for {1} ({2})'.format(settings.get('name'),
                                                                                str(settings.get('context', Interface)),
-                                                                               str(ob)))
+                                                                               str(new_class)))
             config.registry.registerAdapter(new_class,
                                             (settings.get('context', Interface),
                                              settings.get('request_type', IRequest)),