Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor bug fixes for xml interface #3057

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/lib/CIME/XML/entry_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ def get_valid_values(self, vid):

def _get_valid_values(self, node):
valid_values = self.get_element_text("valid_values", root=node)
valid_values_list = None
if valid_values is not None:
valid_values_list = []
if valid_values:
valid_values_list = [item.lstrip() for item in valid_values.split(',')]
return valid_values_list

Expand Down Expand Up @@ -234,7 +234,7 @@ def get_valid_value_string(self, node, value,vid=None, ignore_type=False):
type_str = self._get_type_info(node)
str_value = convert_to_string(value, type_str, vid)

if valid_values is not None and not str_value.startswith('$'):
if valid_values and not str_value.startswith('$'):
expect(str_value in valid_values, "Did not find {} in valid values for {}: {}".format(value, vid, valid_values))
return str_value

Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/CIME/XML/generic_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def set_element_text(self, element_name, new_text, attributes=None, root=None):
return None

def to_string(self, node, method="xml", encoding="us-ascii"):
return ET.tostring(node, method=method, encoding=encoding)
return ET.tostring(node.xml_element, method=method, encoding=encoding)

#
# API for operations over the entire file
Expand Down