[vreg] ensure you can register an object from module not known yet. stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 01 Jun 2010 17:29:49 +0200
branchstable
changeset 5651 95f7285e85e2
parent 5650 86e874fe30ea
child 5652 904091dc4c7e
[vreg] ensure you can register an object from module not known yet. This ease registration of arbitrary objects during testing.
vregistry.py
--- a/vregistry.py	Tue Jun 01 17:03:28 2010 +0200
+++ b/vregistry.py	Tue Jun 01 17:29:49 2010 +0200
@@ -385,7 +385,7 @@
             registry.register(obj, oid=oid, clear=clear)
             self.debug('registered appobject %s in registry %s with id %s',
                        vname, registryname, oid or class_regid(obj))
-        self._loadedmods[obj.__module__][classid(obj)] = obj
+        self._loadedmods.setdefault(obj.__module__, {})[classid(obj)] = obj
 
     def unregister(self, obj, registryname=None):
         """unregister `obj` application object from the registry `registryname` or