def _instantiate_attributes_before_function(self, function=None, context=None): super()._instantiate_attributes_before_function(function=function, context=context) # create transient Parameters objects for custom function params # done here because they need to be present before _instantiate_value which calls self.function for param_name in self.cust_fct_params: p = Parameter(self.cust_fct_params[param_name], modulable=True) setattr(self.parameters, param_name, p) p._set(p.default_value, context, skip_history=True)
def _instantiate_attributes_before_function(self, function=None, context=None): super()._instantiate_attributes_before_function(function=function, context=context) # create transient Parameters objects for custom function params # done here because they need to be present before _instantiate_value which calls self.function for param_name in self.cust_fct_params: p = Parameter(self.cust_fct_params[param_name], modulable=True) setattr(self.parameters, param_name, p) try: attr_name = '_{0}'.format(p.name) attr_value = getattr(self, attr_name) if attr_value is None: attr_value = p.default_value p._set(attr_value, context, skip_history=True) delattr(self, attr_name) except AttributeError: p._set(p.default_value, context, skip_history=True)