[web] Stop using webconfig.vc_config()
The main issue is that this creates an entirely new Repository object
(since commit 3914388b2d0f) and thus reloads all the cubes, taking for
ever.
Related to #8634417.
--- a/test/unittest_cwconfig.py Thu Sep 24 11:26:11 2015 +0200
+++ b/test/unittest_cwconfig.py Tue Nov 24 16:57:07 2015 +0100
@@ -86,15 +86,6 @@
finally:
comment_pkginfo.__recommends_cubes__ = {}
-
-# def test_vc_config(self):
-# vcconf = self.config.vc_config()
-# self.assertIsInstance(vcconf['EEMAIL'], Version)
-# self.assertEqual(vcconf['EEMAIL'], (0, 3, 1))
-# self.assertEqual(vcconf['CW'], (2, 31, 2))
-# self.assertRaises(KeyError, vcconf.__getitem__, 'CW_VERSION')
-# self.assertRaises(KeyError, vcconf.__getitem__, 'CRM')
-
def test_expand_cubes(self):
self.config.__class__.CUBES_PATH = [CUSTOM_CUBES_DIR]
self.config.adjust_sys_path()
--- a/web/views/debug.py Thu Sep 24 11:26:11 2015 +0200
+++ b/web/views/debug.py Tue Nov 24 16:57:07 2015 +0100
@@ -83,7 +83,7 @@
w(u'<tr><th align="left">%s</th><td>%s</td></tr>' % (
_('instance home'), self._cw.vreg.config.apphome))
w(u'</table>')
- vcconf = req.vreg.config.vc_config()
+ vcconf = req.cnx.repo.get_versions()
w(u'<h3>%s</h3>' % _('versions configuration'))
w(u'<table>')
w(u'<tr><th align="left">%s</th><td>%s</td></tr>' % (
--- a/web/views/management.py Thu Sep 24 11:26:11 2015 +0200
+++ b/web/views/management.py Tue Nov 24 16:57:07 2015 +0100
@@ -137,7 +137,7 @@
# if excinfo is not None, it's probably not a bug
if excinfo is None:
return
- vcconf = self._cw.vreg.config.vc_config()
+ 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
--- a/web/webconfig.py Thu Sep 24 11:26:11 2015 +0200
+++ b/web/webconfig.py Tue Nov 24 16:57:07 2015 +0100
@@ -282,6 +282,7 @@
continue
yield key, pdef
+ @deprecated('[3.22] call req.cnx.repo.get_versions() directly')
def vc_config(self):
return self.repository().get_versions()