cwvreg.py
changeset 8701 d94d3a3ba586
parent 8696 0bb18407c053
child 8719 539ed3fb27cb
equal deleted inserted replaced
8700:9064df1c2f99 8701:d94d3a3ba586
   208 
   208 
   209 from rql import RQLHelper
   209 from rql import RQLHelper
   210 from yams.constraints import BASE_CONVERTERS
   210 from yams.constraints import BASE_CONVERTERS
   211 
   211 
   212 from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
   212 from cubicweb import (CW_SOFTWARE_ROOT, ETYPE_NAME_MAP, CW_EVENT_MANAGER,
   213                       Binary, UnknownProperty, UnknownEid)
   213                       onevent, Binary, UnknownProperty, UnknownEid)
   214 from cubicweb.predicates import (implements, appobject_selectable,
   214 from cubicweb.predicates import (implements, appobject_selectable,
   215                                  _reset_is_instance_cache)
   215                                  _reset_is_instance_cache)
   216 
   216 
   217 # backward compat: those modules are now refering to app objects in
   217 
   218 # cw.web.views.uicfg and import * from backward compat. On registry reload, we
   218 @onevent('before-registry-reload')
   219 # should pop those modules from the cache so references are properly updated on
   219 def cleanup_uicfg_compat():
   220 # subsequent reload
   220     """ backward compat: those modules are now refering to app objects in
   221 CW_EVENT_MANAGER.bind('before-registry-reload', partial(sys.modules.pop, 'cubicweb.web.uicfg', None))
   221     cw.web.views.uicfg and import * from backward compat. On registry reload, we
   222 CW_EVENT_MANAGER.bind('before-registry-reload', partial(sys.modules.pop, 'cubicweb.web.uihelper', None))
   222     should pop those modules from the cache so references are properly updated on
       
   223     subsequent reload
       
   224     """
       
   225     if 'cubicweb.web' in sys.modules:
       
   226         if getattr(sys.modules['cubicweb.web'], 'uicfg', None):
       
   227             del sys.modules['cubicweb.web'].uicfg
       
   228         if getattr(sys.modules['cubicweb.web'], 'uihelper', None):
       
   229             del sys.modules['cubicweb.web'].uihelper
       
   230     sys.modules.pop('cubicweb.web.uicfg', None)
       
   231     sys.modules.pop('cubicweb.web.uihelper', None)
   223 
   232 
   224 def use_interfaces(obj):
   233 def use_interfaces(obj):
   225     """return interfaces required by the given object by searching for
   234     """return interfaces required by the given object by searching for
   226     `implements` predicate
   235     `implements` predicate
   227     """
   236     """