##// END OF EJS Templates
use delay_trait_notifications in Configurable._load_config
Min RK -
Show More
@@ -138,17 +138,20 b' class Configurable(HasTraits):'
138 section_names = self.section_names()
138 section_names = self.section_names()
139
139
140 my_config = self._find_my_config(cfg)
140 my_config = self._find_my_config(cfg)
141 for name, config_value in iteritems(my_config):
141
142 if name in traits:
142 # hold trait notifications until after all config has been loaded
143 if isinstance(config_value, LazyConfigValue):
143 with self.delay_trait_notifications():
144 # ConfigValue is a wrapper for using append / update on containers
144 for name, config_value in iteritems(my_config):
145 # without having to copy the
145 if name in traits:
146 initial = getattr(self, name)
146 if isinstance(config_value, LazyConfigValue):
147 config_value = config_value.get_value(initial)
147 # ConfigValue is a wrapper for using append / update on containers
148 # We have to do a deepcopy here if we don't deepcopy the entire
148 # without having to copy the initial value
149 # config object. If we don't, a mutable config_value will be
149 initial = getattr(self, name)
150 # shared by all instances, effectively making it a class attribute.
150 config_value = config_value.get_value(initial)
151 setattr(self, name, deepcopy(config_value))
151 # We have to do a deepcopy here if we don't deepcopy the entire
152 # config object. If we don't, a mutable config_value will be
153 # shared by all instances, effectively making it a class attribute.
154 setattr(self, name, deepcopy(config_value))
152
155
153 def _config_changed(self, name, old, new):
156 def _config_changed(self, name, old, new):
154 """Update all the class traits having ``config=True`` as metadata.
157 """Update all the class traits having ``config=True`` as metadata.
General Comments 0
You need to be logged in to leave comments. Login now