##// END OF EJS Templates
load kwarg traits before loading config...
Min RK -
Show More
@@ -69,6 +69,11 b' class Configurable(HasTraits):'
69 self.parent = parent
69 self.parent = parent
70
70
71 config = kwargs.pop('config', None)
71 config = kwargs.pop('config', None)
72
73 # load kwarg traits, other than config
74 super(Configurable, self).__init__(**kwargs)
75
76 # load config
72 if config is not None:
77 if config is not None:
73 # We used to deepcopy, but for now we are trying to just save
78 # We used to deepcopy, but for now we are trying to just save
74 # by reference. This *could* have side effects as all components
79 # by reference. This *could* have side effects as all components
@@ -81,9 +86,12 b' class Configurable(HasTraits):'
81 else:
86 else:
82 # allow _config_default to return something
87 # allow _config_default to return something
83 self._load_config(self.config)
88 self._load_config(self.config)
84 # This should go second so individual keyword arguments override
89
85 # the values in config.
90 # Ensure explicit kwargs are applied after loading config.
86 super(Configurable, self).__init__(**kwargs)
91 # This is usually redundant, but ensures config doesn't override
92 # explicitly assigned values.
93 for key, value in kwargs.items():
94 setattr(self, key, value)
87
95
88 #-------------------------------------------------------------------------
96 #-------------------------------------------------------------------------
89 # Static trait notifiations
97 # Static trait notifiations
General Comments 0
You need to be logged in to leave comments. Login now