[repo] Don't crash on start when fs schema is missing some db schema entities
This occurs usually while developping and we don't want systematically to
rebuild the database to start the instance or run e.g. i18ninstance.
--- a/cubicweb/server/repository.py Fri Sep 23 13:36:06 2016 +0200
+++ b/cubicweb/server/repository.py Thu May 26 15:38:39 2016 +0200
@@ -234,7 +234,12 @@
# set eids on entities schema
with self.internal_cnx() as cnx:
for etype, eid in cnx.execute('Any XN,X WHERE X is CWEType, X name XN'):
- self.schema.eschema(etype).eid = eid
+ try:
+ self.schema.eschema(etype).eid = eid
+ except KeyError:
+ # etype in the database doesn't exist in the fs schema, this may occur
+ # during dev and we shouldn't crash
+ self.warning('No %s entity type in the file system schema', etype)
else:
# normal start: load the instance schema from the database
self.info('loading schema from the repository')