[repo] kill rebuildinfered feature from Repository.set_schema
This clutters thing and is useless in most cases: when schema just have been
readen from the database or from the file-system, infered relations have just
be calculated.
The only use-case where it should be rebuilt is on migration (ie schema
modification by editing the meta-model using rql), so move this feature there.
--- a/hooks/syncschema.py Wed Apr 24 14:51:06 2013 +0200
+++ b/hooks/syncschema.py Wed Apr 24 14:42:43 2013 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -216,7 +216,10 @@
# commit event should not raise error, while set_schema has chances to
# do so because it triggers full vreg reloading
try:
- repo.set_schema(repo.schema, rebuildinfered=rebuildinfered)
+ if rebuildinfered:
+ repo.schema.rebuild_infered_relations()
+ # trigger vreg reload
+ repo.set_schema(repo.schema)
# CWUser class might have changed, update current session users
cwuser_cls = self.session.vreg['etypes'].etype_class('CWUser')
for session in repo._sessions.itervalues():
--- a/server/repository.py Wed Apr 24 14:51:06 2013 +0200
+++ b/server/repository.py Wed Apr 24 14:42:43 2013 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
@@ -313,9 +313,7 @@
source_config['type'] = type
return sources.get_source(type, source_config, self, eid)
- def set_schema(self, schema, resetvreg=True, rebuildinfered=True):
- if rebuildinfered:
- schema.rebuild_infered_relations()
+ def set_schema(self, schema, resetvreg=True):
self.info('set schema %s %#x', schema.name, id(schema))
if resetvreg:
if self.config._cubes is None: