Take care that cnx may not be set in error view
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 01 Jun 2016 17:04:33 +0200
changeset 11732 45c38bd3e96d
parent 11731 6563113b9caf
child 11733 1913a3e8816a
Take care that cnx may not be set in error view
cubicweb/web/views/management.py
--- a/cubicweb/web/views/management.py	Wed Oct 12 10:59:18 2016 +0200
+++ b/cubicweb/web/views/management.py	Wed Jun 01 17:04:33 2016 +0200
@@ -137,17 +137,18 @@
         # if excinfo is not None, it's probably not a bug
         if excinfo is None:
             return
-        vcconf = self._cw.cnx.repo.get_versions()
-        w(u"<div>")
-        eversion = vcconf.get('cubicweb', self._cw._('no version information'))
-        # NOTE: tuple wrapping needed since eversion is itself a tuple
-        w(u"<b>CubicWeb version:</b> %s<br/>\n" % (eversion,))
-        cversions = []
-        for cube in self._cw.vreg.config.cubes():
-            cubeversion = vcconf.get(cube, self._cw._('no version information'))
-            w(u"<b>Cube %s version:</b> %s<br/>\n" % (cube, cubeversion))
-            cversions.append((cube, cubeversion))
-        w(u"</div>")
+        if self._cw.cnx:
+            vcconf = self._cw.cnx.repo.get_versions()
+            w(u"<div>")
+            eversion = vcconf.get('cubicweb', self._cw._('no version information'))
+            # NOTE: tuple wrapping needed since eversion is itself a tuple
+            w(u"<b>CubicWeb version:</b> %s<br/>\n" % (eversion,))
+            cversions = []
+            for cube in self._cw.vreg.config.cubes():
+                cubeversion = vcconf.get(cube, self._cw._('no version information'))
+                w(u"<b>Cube %s version:</b> %s<br/>\n" % (cube, cubeversion))
+                cversions.append((cube, cubeversion))
+            w(u"</div>")
         # creates a bug submission link if submit-mail is set
         if self._cw.vreg.config['submit-mail']:
             form = self._cw.vreg['forms'].select('base', self._cw, rset=None,