[test] fix in 6203:d3dea5f84404 wasn't enough stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 10 Sep 2010 14:50:43 +0200
branchstable
changeset 6205 41e0e13e10b7
parent 6204 fd6d8f4d1904
child 6206 d4c73211b0b8
[test] fix in 6203:d3dea5f84404 wasn't enough
server/migractions.py
--- a/server/migractions.py	Fri Sep 10 14:45:46 2010 +0200
+++ b/server/migractions.py	Fri Sep 10 14:50:43 2010 +0200
@@ -74,6 +74,13 @@
         clear_cache(self.mih, 'group_mapping')
         self.mih._synchronized.clear()
 
+    @classmethod
+    def mih_register(cls, repo):
+        # may be already registered in tests (e.g. unittest_migractions at
+        # least)
+        if not cls.__regid__ in repo.vreg['after_add_entity_hooks']:
+            repo.vreg.register(ClearGroupMap)
+
 class ServerMigrationHelper(MigrationHelper):
     """specific migration helper for server side  migration scripts,
     providind actions related to schema/data migration
@@ -98,11 +105,9 @@
             # register a hook to clear our group_mapping cache and the
             # self._synchronized set when some group is added or updated
             ClearGroupMap.mih = self
-            # may be already registered in tests (e.g. unittest_migractions)
-            if not ClearGroupMap.__regid__ in repo.vreg['after_add_entity_hooks']:
-                repo.vreg.register(ClearGroupMap)
-                CW_EVENT_MANAGER.bind('after-registry-reload',
-                                      repo.vreg.register, ClearGroupMap)
+            ClearGroupMap.mih_register(repo)
+            CW_EVENT_MANAGER.bind('after-registry-reload',
+                                  ClearGroupMap.mih_register, repo)
             # notify we're starting maintenance (called instead of server_start
             # which is called on regular start
             repo.hm.call_hooks('server_maintenance', repo=repo)