--- a/src/pyams_viewlet/manager.py Wed Nov 27 16:19:05 2019 +0100
+++ b/src/pyams_viewlet/manager.py Wed Nov 27 19:49:36 2019 +0100
@@ -296,12 +296,15 @@
LOGGER.debug("Registering viewlet manager {0} ({1})".format(settings.get('name'),
str(new_class)))
- config = context.config.with_package(info.module) # pylint: disable=no-member
- config.registry.registerAdapter(new_class,
- (settings.get('context', Interface),
- settings.get('layer', IRequest),
- settings.get('view', IView)),
- provides, settings.get('name'))
+ registry = settings.get('registry')
+ if registry is None:
+ config = context.config.with_package(info.module) # pylint: disable=no-member
+ registry = config.registry
+ registry.registerAdapter(new_class,
+ (settings.get('context', Interface),
+ settings.get('layer', IRequest),
+ settings.get('view', IView)),
+ provides, settings.get('name'))
info = self.venusian.attach(wrapped, callback, category='pyams_viewlet')
--- a/src/pyams_viewlet/viewlet.py Wed Nov 27 16:19:05 2019 +0100
+++ b/src/pyams_viewlet/viewlet.py Wed Nov 27 19:49:36 2019 +0100
@@ -118,12 +118,15 @@
LOGGER.debug("Registering content provider {0} ({1})".format(settings.get('name'),
str(new_class)))
- config = context.config.with_package(info.module) # pylint: disable=no-member
- config.registry.registerAdapter(new_class,
- (settings.get('context', Interface),
- settings.get('layer', IRequest),
- settings.get('view', IView)),
- IContentProvider, settings.get('name'))
+ registry = settings.get('registry')
+ if registry is None:
+ config = context.config.with_package(info.module) # pylint: disable=no-member
+ registry = config.registry
+ registry.registerAdapter(new_class,
+ (settings.get('context', Interface),
+ settings.get('layer', IRequest),
+ settings.get('view', IView)),
+ IContentProvider, settings.get('name'))
info = self.venusian.attach(wrapped, callback, category='pyams_viewlet')
@@ -207,13 +210,16 @@
LOGGER.debug("Registering viewlet {0} ({1})".format(settings.get('name'),
str(new_class)))
- config = context.config.with_package(info.module) # pylint: disable=no-member
- config.registry.registerAdapter(new_class,
- (settings.get('context', Interface),
- settings.get('layer', IRequest),
- settings.get('view', IView),
- settings.get('manager', IViewletManager)),
- IViewlet, settings.get('name'))
+ registry = settings.get('registry')
+ if registry is None:
+ config = context.config.with_package(info.module) # pylint: disable=no-member
+ registry = config.registry
+ registry.registerAdapter(new_class,
+ (settings.get('context', Interface),
+ settings.get('layer', IRequest),
+ settings.get('view', IView),
+ settings.get('manager', IViewletManager)),
+ IViewlet, settings.get('name'))
info = self.venusian.attach(wrapped, callback, category='pyams_viewlet')