vregistry.py
changeset 2653 51bf32bbe78d
parent 2651 3ad936634d2a
child 2655 48cd71bdb5cd
equal deleted inserted replaced
2652:3753f3a07ca1 2653:51bf32bbe78d
    29 from warnings import warn
    29 from warnings import warn
    30 
    30 
    31 from cubicweb import CW_SOFTWARE_ROOT, set_log_methods
    31 from cubicweb import CW_SOFTWARE_ROOT, set_log_methods
    32 from cubicweb import (RegistryNotFound, ObjectNotFound, NoSelectableObject,
    32 from cubicweb import (RegistryNotFound, ObjectNotFound, NoSelectableObject,
    33                       RegistryOutOfDate)
    33                       RegistryOutOfDate)
       
    34 
       
    35 # XXX depending on cubicweb.web is ugly, we should deal with uicfg
       
    36 #     reset with a good old event / callback system
       
    37 try:
       
    38     from cubicweb.web import uicfg
       
    39 except ImportError: # cubicweb.web not installed
       
    40     uicfg = None
    34 
    41 
    35 def _toload_info(path, extrapath, _toload=None):
    42 def _toload_info(path, extrapath, _toload=None):
    36     """return a dictionary of <modname>: <modpath> and an ordered list of
    43     """return a dictionary of <modname>: <modpath> and an ordered list of
    37     (file, module name) to load
    44     (file, module name) to load
    38     """
    45     """
   138         self._lastmodifs = {}
   145         self._lastmodifs = {}
   139 
   146 
   140     def reset(self):
   147     def reset(self):
   141         self._registries = {}
   148         self._registries = {}
   142         self._lastmodifs = {}
   149         self._lastmodifs = {}
       
   150         if uicfg is not None:
       
   151             reload(uicfg)
   143 
   152 
   144     def __getitem__(self, key):
   153     def __getitem__(self, key):
   145         return self._registries[key]
   154         return self._registries[key]
   146 
   155 
   147     def get(self, key, default=None):
   156     def get(self, key, default=None):