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

Replaced 'utf8' in ET.tostring with 'utf-8', invalid XML (400) otherwise #538

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions libcloud/compute/drivers/azure.py
Expand Up @@ -1709,7 +1709,8 @@ def _convert_class_to_xml(self, source, xml_prefix=True):
root = ET.Element()
doc = self._construct_element_tree(source, root)

result = ensure_string(ET.tostring(doc, encoding='utf8', method='xml'))
result = ensure_string(ET.tostring(doc, encoding='utf-8',
method='xml'))
return result

def _construct_element_tree(self, source, etree):
Expand Down Expand Up @@ -2108,7 +2109,7 @@ def restart_role_operation_to_xml():
'RestartRoleOperation',
xml
)
result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand All @@ -2119,7 +2120,7 @@ def shutdown_role_operation_to_xml():
'ShutdownRoleOperation',
xml
)
result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand All @@ -2130,7 +2131,7 @@ def start_role_operation_to_xml():
'StartRoleOperation',
xml
)
result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand Down Expand Up @@ -2520,7 +2521,7 @@ def add_role_to_xml(role_name,
system_configuration_set,
doc
)
result = ensure_string(ET.tostring(xml, encoding='utf8'))
result = ensure_string(ET.tostring(xml, encoding='utf-8'))
return result

@staticmethod
Expand All @@ -2547,7 +2548,7 @@ def update_role_to_xml(role_name,
doc
)

result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand Down Expand Up @@ -2587,7 +2588,7 @@ def capture_role_to_xml(post_capture_action,
xml
)
doc = AzureXmlSerializer.doc_from_xml('CaptureRoleOperation', xml)
result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand Down Expand Up @@ -2638,7 +2639,7 @@ def virtual_machine_deployment_to_xml(deployment_name,
)
)

result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand Down Expand Up @@ -2707,7 +2708,7 @@ def doc_from_data(document_element_name, data, extended_properties=None):
)
)

result = ensure_string(ET.tostring(doc, encoding='utf8'))
result = ensure_string(ET.tostring(doc, encoding='utf-8'))
return result

@staticmethod
Expand Down