Show More
@@ -69,6 +69,11 b' class Configurable(HasTraits):' | |||
|
69 | 69 | self.parent = parent |
|
70 | 70 | |
|
71 | 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 | 77 | if config is not None: |
|
73 | 78 | # We used to deepcopy, but for now we are trying to just save |
|
74 | 79 | # by reference. This *could* have side effects as all components |
@@ -81,9 +86,12 b' class Configurable(HasTraits):' | |||
|
81 | 86 | else: |
|
82 | 87 | # allow _config_default to return something |
|
83 | 88 | self._load_config(self.config) |
|
84 | # This should go second so individual keyword arguments override | |
|
85 | # the values in config. | |
|
86 | super(Configurable, self).__init__(**kwargs) | |
|
89 | ||
|
90 | # Ensure explicit kwargs are applied after loading config. | |
|
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 | 97 | # Static trait notifiations |
General Comments 0
You need to be logged in to leave comments.
Login now