1616from wlsdeploy .aliases .alias_constants import ALIAS_MAP_TYPES
1717from wlsdeploy .aliases .alias_constants import ATTRIBUTES
1818from wlsdeploy .aliases .alias_constants import ChildFoldersTypes
19- from wlsdeploy .aliases .alias_constants import DEFAULT
19+ from wlsdeploy .aliases .alias_constants import DEFAULT_VALUE
2020from wlsdeploy .aliases .alias_constants import FLATTENED_FOLDER_DATA
2121from wlsdeploy .aliases .alias_constants import FOLDERS
2222from wlsdeploy .aliases .alias_constants import GET
3838from wlsdeploy .aliases .alias_constants import SET_METHOD
3939from wlsdeploy .aliases .alias_constants import STRING
4040from wlsdeploy .aliases .alias_constants import USES_PATH_TOKENS
41- from wlsdeploy .aliases .alias_constants import VALUE
4241from wlsdeploy .aliases .alias_constants import WLST_NAME
4342from wlsdeploy .aliases .alias_constants import WLST_READ_TYPE
4443from wlsdeploy .aliases .alias_constants import WLST_TYPE
@@ -512,7 +511,7 @@ def get_wlst_attribute_name_and_value(self, location, model_attribute_name, mode
512511 model_val = alias_utils .convert_to_type (LIST , model_attribute_value ,
513512 delimiter = MODEL_LIST_DELIMITER )
514513
515- if uses_path_tokens :
514+ if uses_path_tokens and model_val is not None :
516515 for index , item in enumerate (model_val ):
517516 item_value = self ._model_context .replace_token_string (str (item ))
518517 model_val [index ] = item_value
@@ -990,20 +989,21 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst
990989 delimiter = delimiter )
991990
992991 model_attribute_name = attribute_info [MODEL_NAME ]
993- default_value = attribute_info [VALUE ][ DEFAULT ]
992+ default_value = attribute_info [DEFAULT_VALUE ]
994993
995994 #
996995 # The logic below to compare the str() representation of the converted value and the default value
997996 # only works for lists/maps if both the converted value and the default value are the same data type...
998997 #
999998 if (model_type in ALIAS_LIST_TYPES or model_type in ALIAS_MAP_TYPES ) \
1000- and not (default_value == '[]' or default_value == ' None' ):
999+ and not (default_value == '[]' or default_value is None ):
10011000 # always the model delimiter
10021001 default_value = alias_utils .convert_to_type (model_type , default_value ,
10031002 delimiter = MODEL_LIST_DELIMITER )
10041003
10051004 if attribute_info [WLST_TYPE ] == STRING :
1006- default_value = alias_utils .replace_tokens_in_path (location , default_value )
1005+ if default_value :
1006+ default_value = alias_utils .replace_tokens_in_path (location , default_value )
10071007
10081008 if model_type == 'password' :
10091009 if string_utils .is_empty (wlst_attribute_value ) or converted_value == default_value :
@@ -1021,7 +1021,7 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst
10211021
10221022 elif (model_type in ALIAS_LIST_TYPES or data_type in ALIAS_MAP_TYPES ) and \
10231023 (converted_value is None or len (converted_value ) == 0 ):
1024- if default_value == '[]' or default_value == ' None' :
1024+ if default_value == '[]' or default_value is None :
10251025 model_attribute_value = None
10261026
10271027 elif self ._model_context is not None and USES_PATH_TOKENS in attribute_info :
@@ -1031,6 +1031,10 @@ def get_model_attribute_name_and_value(self, location, wlst_attribute_name, wlst
10311031 model_attribute_value = self ._model_context .tokenize_classpath (converted_value )
10321032 if model_attribute_value == default_value :
10331033 model_attribute_value = None
1034+
1035+ elif default_value is None :
1036+ model_attribute_value = converted_value
1037+
10341038 elif str (converted_value ) != str (default_value ):
10351039 if _strings_are_empty (converted_value , default_value ):
10361040 model_attribute_value = None
@@ -1199,15 +1203,12 @@ def get_model_attribute_default_value(self, location, model_attribute_name):
11991203 default_value = None
12001204 attribute_info = self ._alias_entries .get_alias_attribute_entry_by_model_name (location , model_attribute_name )
12011205 if attribute_info is not None :
1202- default_value = attribute_info [VALUE ][DEFAULT ]
1203- if default_value == 'None' :
1204- default_value = None
1205- else :
1206- data_type , delimiter = \
1207- alias_utils .compute_read_data_type_and_delimiter_from_attribute_info (
1208- attribute_info , default_value )
1206+ default_value = attribute_info [DEFAULT_VALUE ]
1207+ data_type , delimiter = \
1208+ alias_utils .compute_read_data_type_and_delimiter_from_attribute_info (
1209+ attribute_info , default_value )
12091210
1210- default_value = alias_utils .convert_to_type (data_type , default_value , delimiter = delimiter )
1211+ default_value = alias_utils .convert_to_type (data_type , default_value , delimiter = delimiter )
12111212 self ._logger .exiting (class_name = self ._class_name , method_name = _method_name , result = default_value )
12121213 return default_value
12131214 except AliasException , ae :
0 commit comments