mirror of
https://github.com/yweber/lodel2.git
synced 2026-03-14 23:32:02 +01:00
Quick & dirty interfacePlugin implementation + small import bugfixes
Import bugfixes in settings validator. Hooks must be imported in validatore definition to avoid circular import failure
This commit is contained in:
parent
ba244bdd82
commit
585cc61dff
5 changed files with 6 additions and 10 deletions
|
|
@ -43,4 +43,5 @@ from .hooks import LodelHook
|
|||
from .plugins import Plugin, CustomMethod
|
||||
from .datasource_plugin import DatasourcePlugin
|
||||
from .sessionhandler import SessionHandlerPlugin
|
||||
from .interface import InterfacePlugin
|
||||
from .extensions import Extension
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ class MetaPlugType(type):
|
|||
def __register_types(self):
|
||||
plug_type_register(self)
|
||||
|
||||
|
||||
def plug_type_register(cls):
|
||||
__all_ptypes.append(cls)
|
||||
logger.info("New child class registered : %s" % cls.__name__)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import types # for dynamic bindings
|
|||
from collections import namedtuple
|
||||
|
||||
from lodel import logger
|
||||
from lodel.plugin.plugins import Plugin, PluginError
|
||||
from lodel.settings.utils import SettingsError, SettingsErrors
|
||||
from lodel.settings.validator import SettingValidator, LODEL2_CONF_SPECS, \
|
||||
confspec_append
|
||||
|
|
@ -131,6 +130,7 @@ class Settings(object, metaclass=MetaSettings):
|
|||
|
||||
##@brief This method handles Settings instance bootstraping
|
||||
def __bootstrap(self):
|
||||
from lodel.plugin.plugins import Plugin, PluginError
|
||||
logger.debug("Settings bootstraping")
|
||||
lodel2_specs = LODEL2_CONF_SPECS
|
||||
loader = SettingsLoader(self.__conf_dir)
|
||||
|
|
@ -161,6 +161,7 @@ class Settings(object, metaclass=MetaSettings):
|
|||
|
||||
# Starting the Plugins class
|
||||
logger.debug("Starting lodel.plugin.Plugin class")
|
||||
print("DEBUG : plugin list : ", plugin_list)
|
||||
Plugin.start(plugin_list)
|
||||
# Fetching conf specs from plugins
|
||||
specs = [lodel2_specs]
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import socket
|
|||
import inspect
|
||||
import copy
|
||||
|
||||
from lodel.plugin.hooks import LodelHook
|
||||
|
||||
## @package lodel.settings.validator Lodel2 settings validators/cast module
|
||||
#
|
||||
|
|
@ -220,6 +219,7 @@ def host_val(value):
|
|||
raise SettingsValidationError(msg % value)
|
||||
|
||||
def emfield_val(value):
|
||||
from lodel.plugin.hooks import LodelHook
|
||||
spl = value.split('.')
|
||||
if len(spl) != 2:
|
||||
msg = "Expected a value in the form CLASSNAME.FIELDNAME but got : %s"
|
||||
|
|
@ -240,6 +240,7 @@ def emfield_val(value):
|
|||
return value
|
||||
|
||||
def plugin_val(value):
|
||||
from lodel.plugin.hooks import LodelHook
|
||||
spl = value.split('.')
|
||||
if len(spl) != 2:
|
||||
msg = "Expected a value in the form PLUGIN.TYPE but got : %s"
|
||||
|
|
@ -369,10 +370,6 @@ LODEL2_CONF_SPECS = {
|
|||
'lodel2': {
|
||||
'debug': ( True,
|
||||
SettingValidator('bool')),
|
||||
'plugins_path': ( None,
|
||||
SettingValidator('list')),
|
||||
'plugins': ( "",
|
||||
SettingValidator('list')),
|
||||
'sitename': ( 'noname',
|
||||
SettingValidator('strip')),
|
||||
'runtest': ( False,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
[lodel2]
|
||||
debug = False
|
||||
sitename = noname
|
||||
plugins_path = /foo/plugins
|
||||
plugins = dummy, dummy_datasource
|
||||
runtest=True
|
||||
extensions = dummy
|
||||
datasource_connectors = dummy_datasource
|
||||
session_handler = filesystem_session
|
||||
session_handler = ram_session
|
||||
|
||||
[lodel2.logging.stderr]
|
||||
level = Error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue