Commit 133680d7 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange Committed by blissadm@id30_massif3
Browse files

beacon: added session plugin.

parent ef7eb5aa
......@@ -7,30 +7,10 @@
from __future__ import absolute_import
def __find_class(cfg_node, subdir=""):
klass_name = cfg_node['class']
dirs = ['bliss', 'controllers']
if subdir:
dirs.append(subdir)
if 'package' in cfg_node:
module_name = cfg_node['package']
else:
if 'module' in cfg_node:
dirs.append(cfg_node['module'])
else:
# discover module and class name
dirs.append(klass_name.lower())
module_name = '.'.join(dirs)
module = __import__(module_name, fromlist=[''])
klass = getattr(module, klass_name)
return klass
from .utils import find_class
def create_objects_from_config_node(config, item_cfg_node):
klass = __find_class(item_cfg_node)
klass = find_class(item_cfg_node)
item_name = item_cfg_node["name"]
referenced_objects = dict()
......
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from .utils import find_class
def create_objects_from_config_node(config, item_cfg_node):
klass = find_class(item_cfg_node,'bliss.session')
item_name = item_cfg_node["name"]
return { item_name: klass(item_name, item_cfg_node) }
......@@ -8,7 +8,7 @@
from __future__ import absolute_import
import logging
from bliss.common import log
from bliss.config.plugins.bliss import __find_class
from bliss.config.plugins.bliss import find_class
def create_objects_from_config_node(config, item_cfg_node):
......@@ -28,7 +28,7 @@ def create_objects_from_config_node(config, item_cfg_node):
objects.append((name, config_item))
names.setdefault(category, list()).append(name)
controller_class = __find_class(parent_node, subdir="temperature")
controller_class = find_class(parent_node, "bliss.controllers.temperature")
controller = controller_class(parent_node, inputs, outputs, loops)
cache_dict = dict()
......
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
def find_class(cfg_node,base_path='bliss.controllers'):
klass_name = cfg_node['class']
if 'package' in cfg_node:
module_name = cfg_node['package']
elif 'module' in cfg_node:
module_name = '%s.%s' % (base_path,cfg_node['module'])
else:
# discover module and class name
module_name = '%s.%s' % (base_path,klass_name.lower())
module = __import__(module_name, fromlist=[''])
klass = getattr(module, klass_name)
return klass
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment