Commit e4c24bc8 authored by Matias Guijarro's avatar Matias Guijarro

temperature framework: bug: fix double init of objects

parent 0b1f1694
......@@ -51,7 +51,6 @@ class Controller(LogMixin):
)
# self._logger.info("on Controller")
self.__config = config
self._objects = dict()
self._inputs = dict()
self._outputs = dict()
self._loops = dict()
......@@ -61,44 +60,35 @@ class Controller(LogMixin):
for name, cfg in inputs:
self._logger.debug(" input name: %s" % (name))
self._logger.debug(" input config: %s" % (cfg))
self._objects[name] = Input(self, cfg)
self._inputs[name] = Input(self, cfg)
new_input = Input(self, cfg)
self._inputs[name] = new_input
# For custom attributes and commands.
set_custom_members(self, self._inputs[name])
set_custom_members(self, self._objects[name])
self.initialize_input(new_input)
# input object is got from call of get_object
# and not as self._objects[name]
self.initialize_input(self.get_object(name))
# For custom attributes and commands.
set_custom_members(self, new_input)
for name, cfg in outputs:
self._logger.debug(" output name: %s" % (name))
self._logger.debug(" output config: %s" % (cfg))
self._objects[name] = Output(self, cfg)
self._outputs[name] = Output(self, cfg)
new_output = Output(self, cfg)
self._outputs[name] = new_output
# output object is got from call of get_object
# and not as self._objects[name]
self.initialize_output(self.get_object(name))
self.initialize_output(new_output)
# For custom attributes and commands.
set_custom_members(self, self._outputs[name])
set_custom_members(self, self._objects[name])
set_custom_members(self, new_output)
for name, cfg in loops:
self._logger.debug(" loops name: %s" % (name))
self._logger.debug(" loops config: %s" % (cfg))
self._objects[name] = Loop(self, cfg)
self._loops[name] = Loop(self, cfg)
new_loop = Loop(self, cfg)
self._loops[name] = new_loop
# Loop object is got from call of get_object
# and not as self._objects[name]
self.initialize_loop(self.get_object(name))
self.initialize_loop(new_loop)
# For custom attributes and commands.
set_custom_members(self, self._loops[name])
set_custom_members(self, self._objects[name])
set_custom_members(self, new_loop)
@property
def config(self):
......@@ -119,7 +109,7 @@ class Controller(LogMixin):
"""
self._logger.info("Controller:get_object: %s" % (name))
# it is used by Loop class
return self._objects.get(name)
return self._inputs.get(name, self._outputs.get(name, self._loops.get(name)))
def initialize(self):
"""
......
Markdown is supported
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