look for cubicweb-ctl plugins in the ccplugin.py file, keeping bw compat on ecplugin.py
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 18 Dec 2009 14:07:16 +0100
changeset 4135 cb0d0bf255f7
parent 4110 8728d8c95985
child 4136 47060a66c97f
look for cubicweb-ctl plugins in the ccplugin.py file, keeping bw compat on ecplugin.py
cwconfig.py
--- a/cwconfig.py	Thu Dec 10 18:00:15 2009 +0100
+++ b/cwconfig.py	Fri Dec 18 14:07:16 2009 +0100
@@ -78,10 +78,11 @@
 import sys
 import os
 import logging
+import tempfile
 from smtplib import SMTP
 from threading import Lock
 from os.path import exists, join, expanduser, abspath, normpath, basename, isdir
-import tempfile
+from warnings import warn
 
 from logilab.common.decorators import cached
 from logilab.common.deprecation import deprecated
@@ -480,14 +481,23 @@
                                 (ctlfile, err))
                 cls.info('loaded cubicweb-ctl plugin %s', ctlfile)
         for cube in cls.available_cubes():
-            pluginfile = join(cls.cube_dir(cube), 'ecplugin.py')
+            oldpluginfile = join(cls.cube_dir(cube), 'ecplugin.py')
+            pluginfile = join(cls.cube_dir(cube), 'ccplugin.py')
             initfile = join(cls.cube_dir(cube), '__init__.py')
             if exists(pluginfile):
                 try:
+                    __import__('cubes.%s.ccplugin' % cube)
+                    cls.info('loaded cubicweb-ctl plugin from %s', cube)
+                except:
+                    cls.exception('while loading plugin %s', pluginfile)
+            elif exists(oldpluginfile):
+                warn('[3.6] %s: ecplugin module should be renamed to ccplugin' % cube,
+                     DeprecationWarning)
+                try:
                     __import__('cubes.%s.ecplugin' % cube)
                     cls.info('loaded cubicweb-ctl plugin from %s', cube)
                 except:
-                    cls.exception('while loading plugin %s', pluginfile)
+                    cls.exception('while loading plugin %s', oldpluginfile)
             elif exists(initfile):
                 try:
                     __import__('cubes.%s' % cube)