##// 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 138 section_names = self.section_names()
139 139
140 140 my_config = self._find_my_config(cfg)
141 for name, config_value in iteritems(my_config):
142 if name in traits:
143 if isinstance(config_value, LazyConfigValue):
144 # ConfigValue is a wrapper for using append / update on containers
145 # without having to copy the
146 initial = getattr(self, name)
147 config_value = config_value.get_value(initial)
148 # We have to do a deepcopy here if we don't deepcopy the entire
149 # config object. If we don't, a mutable config_value will be
150 # shared by all instances, effectively making it a class attribute.
151 setattr(self, name, deepcopy(config_value))
141
142 # hold trait notifications until after all config has been loaded
143 with self.delay_trait_notifications():
144 for name, config_value in iteritems(my_config):
145 if name in traits:
146 if isinstance(config_value, LazyConfigValue):
147 # ConfigValue is a wrapper for using append / update on containers
148 # without having to copy the initial value
149 initial = getattr(self, name)
150 config_value = config_value.get_value(initial)
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 156 def _config_changed(self, name, old, new):
154 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