cwvreg.py
changeset 6617 120c7ea6e1fa
parent 6454 97203d0af4cb
child 6742 e03d427209cb
equal deleted inserted replaced
6616:26587186b856 6617:120c7ea6e1fa
   460         return getattr(self.vreg[self.redirecto], attr)
   460         return getattr(self.vreg[self.redirecto], attr)
   461 
   461 
   462     def clear(self): pass
   462     def clear(self): pass
   463     def initialization_completed(self): pass
   463     def initialization_completed(self): pass
   464 
   464 
       
   465 
   465 class CubicWebVRegistry(VRegistry):
   466 class CubicWebVRegistry(VRegistry):
   466     """Central registry for the cubicweb instance, extending the generic
   467     """Central registry for the cubicweb instance, extending the generic
   467     VRegistry with some cubicweb specific stuff.
   468     VRegistry with some cubicweb specific stuff.
   468 
   469 
   469     This is one of the central object in cubicweb instance, coupling
   470     This is one of the central object in cubicweb instance, coupling
   556 
   557 
   557     def reload_if_needed(self):
   558     def reload_if_needed(self):
   558         path = self.config.vregistry_path()
   559         path = self.config.vregistry_path()
   559         if self.is_reload_needed(path):
   560         if self.is_reload_needed(path):
   560             self.reload(path)
   561             self.reload(path)
       
   562 
       
   563     def load_file(self, filepath, modname):
       
   564         try:
       
   565             super(CubicWebVRegistry, self).load_file(filepath, modname)
       
   566         except ImportError:
       
   567             if self.config.debugmode:
       
   568                 raise
       
   569             self.exception('failed to load %s from %s', filepath, modname)
   561 
   570 
   562     def reload(self, path, force_reload=True):
   571     def reload(self, path, force_reload=True):
   563         """modification detected, reset and reload the vreg"""
   572         """modification detected, reset and reload the vreg"""
   564         CW_EVENT_MANAGER.emit('before-registry-reload')
   573         CW_EVENT_MANAGER.emit('before-registry-reload')
   565         if force_reload:
   574         if force_reload: