Commit 0547e40f authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

config: replace reference by object from node where **class** is find.

parent 0f9135c9
......@@ -6,17 +6,17 @@
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from .utils import find_class, replace_reference_by_object
from .utils import find_class_and_node, replace_reference_by_object
def create_objects_from_config_node(config, cfg_node):
item_cfg_node = cfg_node.deep_copy()
klass = find_class(item_cfg_node)
klass, node = find_class_and_node(item_cfg_node)
item_name = item_cfg_node["name"]
referenced_objects = dict()
replace_reference_by_object(config, item_cfg_node, referenced_objects)
replace_reference_by_object(config, node, referenced_objects)
o = klass(item_name, item_cfg_node)
......@@ -16,7 +16,7 @@ from bliss.common.axis import Axis, AxisRef
from bliss.common.encoder import Encoder
from bliss.config.static import Config, get_config
from bliss.common.tango import DeviceProxy
from bliss.config.plugins.bliss import find_class
from bliss.config.plugins.utils import find_class
import bliss.controllers.motors
import gevent
......@@ -8,7 +8,7 @@
import logging
from bliss.common import log
from bliss.config.plugins.bliss import find_class
from bliss.config.plugins.utils import find_class
def create_objects_from_config_node(config, item_cfg_node):
......@@ -7,6 +7,10 @@
def find_class(cfg_node, base_path="bliss.controllers"):
return find_class_and_node(cfg_node, base_path)[0]
def find_class_and_node(cfg_node, base_path="bliss.controllers"):
klass_name, node = cfg_node.get_inherited_value_and_node("class")
if klass_name is None:
raise KeyError("class")
......@@ -25,7 +29,7 @@ def find_class(cfg_node, base_path="bliss.controllers"):
except AttributeError:
klass = getattr(module, klass_name.title())
return klass
return klass, node
def _checkref(config, item_cfg_node, referenced_objects, name, value):
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