Browse Source

Quick & dirty interfacePlugin implementation + small import bugfixes

Import bugfixes in settings validator. Hooks must be imported in validatore definition to avoid circular import failure
Yann Weber 8 years ago
parent
commit
585cc61dff

+ 1
- 0
lodel/plugin/__init__.py View File

43
 from .plugins import Plugin, CustomMethod
43
 from .plugins import Plugin, CustomMethod
44
 from .datasource_plugin import DatasourcePlugin
44
 from .datasource_plugin import DatasourcePlugin
45
 from .sessionhandler import SessionHandlerPlugin
45
 from .sessionhandler import SessionHandlerPlugin
46
+from .interface import InterfacePlugin
46
 from .extensions import Extension
47
 from .extensions import Extension

+ 0
- 1
lodel/plugin/plugins.py View File

173
     def __register_types(self):
173
     def __register_types(self):
174
         plug_type_register(self)
174
         plug_type_register(self)
175
 
175
 
176
-
177
 def plug_type_register(cls):
176
 def plug_type_register(cls):
178
     __all_ptypes.append(cls)
177
     __all_ptypes.append(cls)
179
     logger.info("New child class registered : %s" % cls.__name__)
178
     logger.info("New child class registered : %s" % cls.__name__)

+ 2
- 1
lodel/settings/settings.py View File

9
 from collections import namedtuple
9
 from collections import namedtuple
10
 
10
 
11
 from lodel import logger
11
 from lodel import logger
12
-from lodel.plugin.plugins import Plugin, PluginError
13
 from lodel.settings.utils import SettingsError, SettingsErrors
12
 from lodel.settings.utils import SettingsError, SettingsErrors
14
 from lodel.settings.validator import SettingValidator, LODEL2_CONF_SPECS, \
13
 from lodel.settings.validator import SettingValidator, LODEL2_CONF_SPECS, \
15
     confspec_append
14
     confspec_append
131
 
130
 
132
     ##@brief This method handles Settings instance bootstraping
131
     ##@brief This method handles Settings instance bootstraping
133
     def __bootstrap(self):
132
     def __bootstrap(self):
133
+        from lodel.plugin.plugins import Plugin, PluginError
134
         logger.debug("Settings bootstraping")
134
         logger.debug("Settings bootstraping")
135
         lodel2_specs = LODEL2_CONF_SPECS
135
         lodel2_specs = LODEL2_CONF_SPECS
136
         loader = SettingsLoader(self.__conf_dir) 
136
         loader = SettingsLoader(self.__conf_dir) 
161
 
161
 
162
         # Starting the Plugins class
162
         # Starting the Plugins class
163
         logger.debug("Starting lodel.plugin.Plugin class")
163
         logger.debug("Starting lodel.plugin.Plugin class")
164
+        print("DEBUG : plugin list : ", plugin_list)
164
         Plugin.start(plugin_list)
165
         Plugin.start(plugin_list)
165
         # Fetching conf specs from plugins
166
         # Fetching conf specs from plugins
166
         specs = [lodel2_specs]
167
         specs = [lodel2_specs]

+ 2
- 5
lodel/settings/validator.py View File

7
 import inspect
7
 import inspect
8
 import copy
8
 import copy
9
 
9
 
10
-from lodel.plugin.hooks import LodelHook
11
 
10
 
12
 ## @package lodel.settings.validator Lodel2 settings validators/cast module
11
 ## @package lodel.settings.validator Lodel2 settings validators/cast module
13
 #
12
 #
220
         raise SettingsValidationError(msg % value)
219
         raise SettingsValidationError(msg % value)
221
 
220
 
222
 def emfield_val(value):
221
 def emfield_val(value):
222
+    from lodel.plugin.hooks import LodelHook
223
     spl = value.split('.')
223
     spl = value.split('.')
224
     if len(spl) != 2:
224
     if len(spl) != 2:
225
         msg = "Expected a value in the form CLASSNAME.FIELDNAME but got : %s"
225
         msg = "Expected a value in the form CLASSNAME.FIELDNAME but got : %s"
240
     return value
240
     return value
241
 
241
 
242
 def plugin_val(value):
242
 def plugin_val(value):
243
+    from lodel.plugin.hooks import LodelHook
243
     spl = value.split('.')
244
     spl = value.split('.')
244
     if len(spl) != 2:
245
     if len(spl) != 2:
245
         msg = "Expected a value in the form PLUGIN.TYPE but got : %s"
246
         msg = "Expected a value in the form PLUGIN.TYPE but got : %s"
369
     'lodel2': {
370
     'lodel2': {
370
         'debug': (  True,
371
         'debug': (  True,
371
                     SettingValidator('bool')),
372
                     SettingValidator('bool')),
372
-        'plugins_path': (   None,
373
-                            SettingValidator('list')),
374
-        'plugins': (    "",
375
-                        SettingValidator('list')),
376
         'sitename': (   'noname',
373
         'sitename': (   'noname',
377
                         SettingValidator('strip')),
374
                         SettingValidator('strip')),
378
         'runtest': (    False,
375
         'runtest': (    False,

+ 1
- 3
tests/tests_conf.d/lodel2.ini View File

1
 [lodel2]
1
 [lodel2]
2
 debug = False
2
 debug = False
3
 sitename = noname
3
 sitename = noname
4
-plugins_path = /foo/plugins
5
-plugins = dummy, dummy_datasource
6
 runtest=True
4
 runtest=True
7
 extensions = dummy
5
 extensions = dummy
8
 datasource_connectors = dummy_datasource
6
 datasource_connectors = dummy_datasource
9
-session_handler = filesystem_session
7
+session_handler = ram_session
10
 
8
 
11
 [lodel2.logging.stderr]
9
 [lodel2.logging.stderr]
12
 level = Error
10
 level = Error

Loading…
Cancel
Save