[uicfg] reload uicfg when vregistry is being reset
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Sun, 02 Aug 2009 20:59:57 +0200
changeset 2653 51bf32bbe78d
parent 2652 3753f3a07ca1
child 2654 6512522860aa
[uicfg] reload uicfg when vregistry is being reset
vregistry.py
--- a/vregistry.py	Sun Aug 02 20:56:05 2009 +0200
+++ b/vregistry.py	Sun Aug 02 20:59:57 2009 +0200
@@ -32,6 +32,13 @@
 from cubicweb import (RegistryNotFound, ObjectNotFound, NoSelectableObject,
                       RegistryOutOfDate)
 
+# XXX depending on cubicweb.web is ugly, we should deal with uicfg
+#     reset with a good old event / callback system
+try:
+    from cubicweb.web import uicfg
+except ImportError: # cubicweb.web not installed
+    uicfg = None
+
 def _toload_info(path, extrapath, _toload=None):
     """return a dictionary of <modname>: <modpath> and an ordered list of
     (file, module name) to load
@@ -140,6 +147,8 @@
     def reset(self):
         self._registries = {}
         self._lastmodifs = {}
+        if uicfg is not None:
+            reload(uicfg)
 
     def __getitem__(self, key):
         return self._registries[key]