# HG changeset patch # User Sylvain Thénault # Date 1266308615 -3600 # Node ID 47acae3cb778a5fb6874112a6d35d4515d86023f # Parent 2172c8c29fe64d32b51babd9403bbf6a5a60a4fa don't let set_schema making commit_event fail diff -r 2172c8c29fe6 -r 47acae3cb778 hooks/syncschema.py --- a/hooks/syncschema.py Mon Feb 15 19:37:57 2010 +0100 +++ b/hooks/syncschema.py Tue Feb 16 09:23:35 2010 +0100 @@ -161,11 +161,16 @@ def commit_event(self): rebuildinfered = self.session.data.get('rebuild-infered', True) repo = self.session.repo - repo.set_schema(repo.schema, rebuildinfered=rebuildinfered) - # CWUser class might have changed, update current session users - cwuser_cls = self.session.vreg['etypes'].etype_class('CWUser') - for session in repo._sessions.values(): - session.user.__class__ = cwuser_cls + # 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) + # CWUser class might have changed, update current session users + cwuser_cls = self.session.vreg['etypes'].etype_class('CWUser') + for session in repo._sessions.values(): + session.user.__class__ = cwuser_cls + except: + self.critical('error while setting schmea', exc_info=True) def rollback_event(self): self.precommit_event()