# HG changeset patch # User Sylvain Thénault # Date 1366807363 -7200 # Node ID 58b3b2d9c9659c1b5f8fc720bc2a6227a6592723 # Parent 0f60f1061a2eb5d16e8ec14a6ed26cd423636150 [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. diff -r 0f60f1061a2e -r 58b3b2d9c965 hooks/syncschema.py --- 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(): diff -r 0f60f1061a2e -r 58b3b2d9c965 server/repository.py --- 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: