# HG changeset patch # User Florent Cayré # Date 1479208802 -3600 # Node ID a85b7a898e1303e6eae7cd0bfcc492b16ea0b248 # Parent fdc0a8260fd2c105341604343c991d0eb6f31eb8 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. diff -r fdc0a8260fd2 -r a85b7a898e13 cubicweb/server/repository.py --- 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