[server] Replace server config's init_cnxset_pool attribute by a "bootstrap" parameter in Repository
This 'init_cnxset_pool' class attribute is actually used to control whether a
Repository instance should be "bootstraped" (see Repository.init_cnxset_pool()
for a definition of "bootstrap") or not. I seems clearer to me to have this
controlled by a boolean "bootstrap" initialization parameter in Repository.
--- a/cubicweb/server/migractions.py Thu Feb 23 17:38:47 2017 +0100
+++ b/cubicweb/server/migractions.py Thu Feb 23 17:45:50 2017 +0100
@@ -268,8 +268,7 @@
written_format = format_file.readline().strip()
if written_format in ('portable', 'native'):
format = written_format
- self.config.init_cnxset_pool = False
- repo = self.repo = repository.Repository(self.config)
+ repo = self.repo = repository.Repository(self.config, bootstrap=False)
source = repo.system_source
try:
source.restore(osp.join(tmpdir, source.uri), self.confirm, drop, format)
--- a/cubicweb/server/repository.py Thu Feb 23 17:38:47 2017 +0100
+++ b/cubicweb/server/repository.py Thu Feb 23 17:45:50 2017 +0100
@@ -211,7 +211,7 @@
entities and relations
"""
- def __init__(self, config, tasks_manager=None, vreg=None):
+ def __init__(self, config, tasks_manager=None, vreg=None, bootstrap=True):
self.config = config
self.sources_by_eid = {}
if vreg is None:
@@ -240,7 +240,7 @@
# cache eid -> type
self._type_cache = {}
# open some connection sets
- if config.init_cnxset_pool:
+ if bootstrap:
self.init_cnxset_pool()
# the hooks manager
self.hm = hook.HooksManager(self.vreg)
--- a/cubicweb/server/serverconfig.py Thu Feb 23 17:38:47 2017 +0100
+++ b/cubicweb/server/serverconfig.py Thu Feb 23 17:45:50 2017 +0100
@@ -220,10 +220,6 @@
}),
) + CubicWebConfiguration.options)
- # should we init the connections pool (eg connect to sources). This is
- # usually necessary...
- init_cnxset_pool = True
-
# read the schema from the database
read_instance_schema = True
# set this to true to get a minimal repository, for instance to get cubes