cwconfig.py
changeset 7990 a673d1d9a738
parent 7879 9aae456abab5
child 8049 a48301a44b50
equal deleted inserted replaced
7989:db76e8aaec29 7990:a673d1d9a738
   610                 except ImportError, err:
   610                 except ImportError, err:
   611                     cls.error('could not import the command provider %s: %s',
   611                     cls.error('could not import the command provider %s: %s',
   612                               ctlfile, err)
   612                               ctlfile, err)
   613                 cls.info('loaded cubicweb-ctl plugin %s', ctlfile)
   613                 cls.info('loaded cubicweb-ctl plugin %s', ctlfile)
   614         for cube in cls.available_cubes():
   614         for cube in cls.available_cubes():
   615             oldpluginfile = join(cls.cube_dir(cube), 'ecplugin.py')
       
   616             pluginfile = join(cls.cube_dir(cube), 'ccplugin.py')
   615             pluginfile = join(cls.cube_dir(cube), 'ccplugin.py')
   617             initfile = join(cls.cube_dir(cube), '__init__.py')
   616             initfile = join(cls.cube_dir(cube), '__init__.py')
   618             if exists(pluginfile):
   617             if exists(pluginfile):
   619                 try:
   618                 try:
   620                     __import__('cubes.%s.ccplugin' % cube)
   619                     __import__('cubes.%s.ccplugin' % cube)
   621                     cls.info('loaded cubicweb-ctl plugin from %s', cube)
   620                     cls.info('loaded cubicweb-ctl plugin from %s', cube)
   622                 except Exception:
   621                 except Exception:
   623                     cls.exception('while loading plugin %s', pluginfile)
   622                     cls.exception('while loading plugin %s', pluginfile)
   624             elif exists(oldpluginfile):
       
   625                 warn('[3.6] %s: ecplugin module should be renamed to ccplugin' % cube,
       
   626                      DeprecationWarning)
       
   627                 try:
       
   628                     __import__('cubes.%s.ecplugin' % cube)
       
   629                     cls.info('loaded cubicweb-ctl plugin from %s', cube)
       
   630                 except Exception:
       
   631                     cls.exception('while loading plugin %s', oldpluginfile)
       
   632             elif exists(initfile):
   623             elif exists(initfile):
   633                 try:
   624                 try:
   634                     __import__('cubes.%s' % cube)
   625                     __import__('cubes.%s' % cube)
   635                 except Exception:
   626                 except Exception:
   636                     cls.exception('while loading cube %s', cube)
   627                     cls.exception('while loading cube %s', cube)
   760         for path in reversed(paths):
   751         for path in reversed(paths):
   761             sitefile = join(path, 'site_cubicweb.py')
   752             sitefile = join(path, 'site_cubicweb.py')
   762             if exists(sitefile) and not sitefile in self._site_loaded:
   753             if exists(sitefile) and not sitefile in self._site_loaded:
   763                 self._load_site_cubicweb(sitefile)
   754                 self._load_site_cubicweb(sitefile)
   764                 self._site_loaded.add(sitefile)
   755                 self._site_loaded.add(sitefile)
   765             else:
       
   766                 sitefile = join(path, 'site_erudi.py')
       
   767                 if exists(sitefile) and not sitefile in self._site_loaded:
       
   768                     self._load_site_cubicweb(sitefile)
       
   769                     self._site_loaded.add(sitefile)
       
   770                     self.warning('[3.5] site_erudi.py is deprecated, should be '
       
   771                                  'renamed to site_cubicweb.py')
       
   772 
   756 
   773     def _load_site_cubicweb(self, sitefile):
   757     def _load_site_cubicweb(self, sitefile):
   774         # XXX extrapath argument to load_module_from_file only in lgc > 0.50.2
   758         # XXX extrapath argument to load_module_from_file only in lgc > 0.50.2
   775         from logilab.common.modutils import load_module_from_modpath, modpath_from_file
   759         from logilab.common.modutils import load_module_from_modpath, modpath_from_file
   776         module = load_module_from_modpath(modpath_from_file(sitefile, self.extrapath))
   760         module = load_module_from_modpath(modpath_from_file(sitefile, self.extrapath))