Преглед на файлове

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 години
родител
ревизия
585cc61dff
променени са 5 файла, в които са добавени 6 реда и са изтрити 10 реда
  1. 1
    0
      lodel/plugin/__init__.py
  2. 0
    1
      lodel/plugin/plugins.py
  3. 2
    1
      lodel/settings/settings.py
  4. 2
    5
      lodel/settings/validator.py
  5. 1
    3
      tests/tests_conf.d/lodel2.ini

+ 1
- 0
lodel/plugin/__init__.py Целия файл

@@ -43,4 +43,5 @@ from .hooks import LodelHook
43 43
 from .plugins import Plugin, CustomMethod
44 44
 from .datasource_plugin import DatasourcePlugin
45 45
 from .sessionhandler import SessionHandlerPlugin
46
+from .interface import InterfacePlugin
46 47
 from .extensions import Extension

+ 0
- 1
lodel/plugin/plugins.py Целия файл

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

+ 2
- 1
lodel/settings/settings.py Целия файл

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

+ 2
- 5
lodel/settings/validator.py Целия файл

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

+ 1
- 3
tests/tests_conf.d/lodel2.ini Целия файл

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

Loading…
Отказ
Запис