@@ -730,12 +730,19 @@ def _is_valid_default_value(self, location, generated_attribute, generated_attri
730
730
match = True
731
731
model_name = None
732
732
model_value = None
733
- # aliases will automatically return None for a None in value
733
+ is_derived_default = False
734
734
if generated_default is not None :
735
735
try :
736
+ # This code is sort of non-intuitive because the method was written for a different
737
+ # purpose. This get_model_attribute_name_and_value() function compared the value
738
+ # we pass in with the alias default (accounting for type conversion). If the value
739
+ # passed in matches the alias default value, it returns None for model_value.
740
+ # Otherwise, it returns the passed in value converted to the alias type, if necessary.
741
+ #
736
742
model_name , model_value = \
737
743
self ._alias_helper .get_model_attribute_name_and_value (location , generated_attribute ,
738
744
generated_default )
745
+ is_derived_default = self ._alias_helper .is_derived_default (location , model_name )
739
746
except TypeError , te :
740
747
self ._add_error (location , ERROR_ATTRIBUTE_WRONG_DEFAULT_VALUE ,
741
748
message = te , attribute = generated_attribute )
@@ -747,8 +754,10 @@ def _is_valid_default_value(self, location, generated_attribute, generated_attri
747
754
else :
748
755
model_value = model_default_value
749
756
750
- if match and model_value is not None :
751
- match = False
757
+ # This if statement will be true if the default values do not match and the alias attribute
758
+ # is not marked as a derived_default.
759
+ #
760
+ if match and model_value is not None and not is_derived_default :
752
761
attr_type = type (generated_default )
753
762
if CMO_TYPE in generated_attribute_info and \
754
763
(generated_attribute_info [CMO_TYPE ] == alias_constants .BOOLEAN or
@@ -799,7 +808,8 @@ def _is_valid_restart(self, location, generated_attribute, generated_attribute_i
799
808
self ._add_error (location , ERROR_ATTRIBUTE_NOT_RESTART , attribute = model_attribute_name )
800
809
valid = False
801
810
elif RESTART in generated_attribute_info and generated_attribute_info [RESTART ] == 'true' :
802
- self ._add_error (location , ERROR_ATTRIBUTE_RESTART , attribute = generated_attribute )
811
+ # TODO - temporary change to warning until we decide what to do about the restart attributes of the aliases.
812
+ self ._add_warning (location , ERROR_ATTRIBUTE_RESTART , attribute = generated_attribute )
803
813
valid = False
804
814
805
815
_logger .exiting (result = verify_utils .bool_to_string (valid ), class_name = CLASS_NAME , method_name = _method_name )
0 commit comments