[pyramid] Move loading of pyramid_debugtoolbar later in includeme()
authorDenis Laxalde <denis.laxalde@logilab.fr>
Tue, 21 Feb 2017 17:42:46 +0100
changeset 11969 2fb941d12d74
parent 11968 bb0dfc7d2d0e
child 11970 b282ef22b5ab
[pyramid] Move loading of pyramid_debugtoolbar later in includeme() To gather cwconfig and repository instantiations.
cubicweb/pyramid/__init__.py
--- a/cubicweb/pyramid/__init__.py	Tue Feb 21 08:54:20 2017 +0100
+++ b/cubicweb/pyramid/__init__.py	Tue Feb 21 17:42:46 2017 +0100
@@ -197,13 +197,6 @@
             config.registry.settings['cubicweb.instance'], debugmode=debugmode)
         config.registry['cubicweb.config'] = cwconfig
 
-    if cwconfig.debugmode:
-        try:
-            config.include('pyramid_debugtoolbar')
-        except ImportError:
-            warn('pyramid_debugtoolbar package not available, install it to '
-                 'get UI debug features', RuntimeWarning)
-
     config.registry['cubicweb.repository'] = repo = cwconfig.repository()
     config.registry['cubicweb.registry'] = repo.vreg
 
@@ -219,3 +212,10 @@
 
     if asbool(config.registry.settings.get('cubicweb.bwcompat', True)):
         config.include('cubicweb.pyramid.bwcompat')
+
+    if cwconfig.debugmode:
+        try:
+            config.include('pyramid_debugtoolbar')
+        except ImportError:
+            warn('pyramid_debugtoolbar package not available, install it to '
+                 'get UI debug features', RuntimeWarning)