[hooks] update CWUser class after schema changes stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Tue, 17 Nov 2009 11:47:58 +0100
branchstable
changeset 3870 a6b029aa0f44
parent 3869 ec6463886ac4
child 3871 983acb2b303b
[hooks] update CWUser class after schema changes
server/schemahooks.py
--- a/server/schemahooks.py	Tue Nov 17 11:46:07 2009 +0100
+++ b/server/schemahooks.py	Tue Nov 17 11:47:58 2009 +0100
@@ -142,6 +142,10 @@
     def commit_event(self):
         rebuildinfered = self.session.data.get('rebuild-infered', True)
         self.repo.set_schema(self.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 self.repo._sessions.values():
+            session.user.__class__ = cwuser_cls
 
     def rollback_event(self):
         self.precommit_event()