[vreg] on registration completed, don't crash if an object depends on an unexistant registry, simply kick the object out
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 21 May 2010 13:34:52 +0200
changeset 5562 4ccd599b5cf0
parent 5561 58b05c314443
child 5563 26e242ba3da5
[vreg] on registration completed, don't crash if an object depends on an unexistant registry, simply kick the object out
cwvreg.py
--- a/cwvreg.py	Fri May 21 13:34:03 2010 +0200
+++ b/cwvreg.py	Fri May 21 13:34:52 2010 +0200
@@ -617,13 +617,18 @@
             # since 3.9: remove appobjects which depending on other, unexistant
             # appobjects
             for obj, (regname, regids) in self._needs_appobject.items():
-                registry = self[regname]
+                try:
+                    registry = self[regname]
+                except RegistryNotFound:
+                    self.debug('kicking %s (no registry %s)', obj, regname)
+                    self.unregister(obj)
+                    continue
                 for regid in regids:
                     if registry.get(regid):
                         break
                 else:
                     self.debug('kicking %s (no %s object in registry %s)',
-                               obj, ' or '.join(regids), registry)
+                               obj, ' or '.join(regids), regname)
                     self.unregister(obj)
         super(CubicWebVRegistry, self).initialization_completed()
         for rtag in RTAGS: