Fix AttributeError on postcommit when db-create adds non-system CWSource entities
In this case, `Repository.add_source` is called from an operation, not from
`Repository.init_sources_from_database`, thus the attribute `sources_by_eid`
does not exist.
Closes #16251078.
--- a/cubicweb/server/repository.py Wed Nov 09 23:00:00 2016 +0100
+++ b/cubicweb/server/repository.py Tue Nov 15 12:20:02 2016 +0100
@@ -157,6 +157,7 @@
def __init__(self, config, tasks_manager=None, vreg=None):
self.config = config
+ self.sources_by_eid = {}
if vreg is None:
vreg = cwvreg.CWRegistryStore(config)
self.vreg = vreg
@@ -264,7 +265,6 @@
# internals ###############################################################
def init_sources_from_database(self):
- self.sources_by_eid = {}
if self.config.quick_start or 'CWSource' not in self.schema: # 3.10 migration
self.system_source.init_creating()
return