diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/common.py | 5 | ||||
| -rw-r--r-- | nova/api/openstack/flavors.py | 5 | ||||
| -rw-r--r-- | nova/api/openstack/images.py | 5 | ||||
| -rw-r--r-- | nova/api/openstack/ips.py | 6 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 4 | ||||
| -rw-r--r-- | nova/api/openstack/wsgi.py | 5 |
6 files changed, 6 insertions, 24 deletions
diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index d9371b89a..7dde68975 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -302,11 +302,6 @@ class MetadataXMLSerializer(wsgi.XMLDictSerializer): meta_elem.text = value return meta_elem - def _to_xml(self, root): - """Convert the xml object to an xml string.""" - - return etree.tostring(root, encoding='UTF-8') - def index(self, metadata_dict): metadata = etree.Element('metadata', nsmap=self.NSMAP) self._populate_metadata(metadata, metadata_dict.get('metadata', {})) diff --git a/nova/api/openstack/flavors.py b/nova/api/openstack/flavors.py index f689aa7ab..805aad772 100644 --- a/nova/api/openstack/flavors.py +++ b/nova/api/openstack/flavors.py @@ -99,11 +99,6 @@ class FlavorXMLSerializer(wsgi.XMLDictSerializer): elem.set('href', link['href']) return flavor_elem - def _to_xml(self, root): - """Convert the xml object to an xml string.""" - - return etree.tostring(root, encoding='UTF-8') - def show(self, flavor_container): flavor = etree.Element('flavor', nsmap=self.NSMAP) self._populate_flavor(flavor, flavor_container['flavor'], True) diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index edd26c171..48c53d6d5 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -254,11 +254,6 @@ class ImageXMLSerializer(wsgi.XMLDictSerializer): elem.set('href', link['href']) return image_elem - def _to_xml(self, root): - """Convert the xml object to an xml string.""" - - return etree.tostring(root, encoding='UTF-8') - def index(self, images_dict): images = etree.Element('images', nsmap=self.NSMAP) for image_dict in images_dict['images']: diff --git a/nova/api/openstack/ips.py b/nova/api/openstack/ips.py index 0147d66f8..d5a715dda 100644 --- a/nova/api/openstack/ips.py +++ b/nova/api/openstack/ips.py @@ -104,7 +104,7 @@ class ControllerV11(Controller): class IPXMLSerializer(wsgi.XMLDictSerializer): - NSMAP = {None: xmlutil.XMLNS_V11, 'atom': xmlutil.XMLNS_ATOM} + NSMAP = {None: xmlutil.XMLNS_V11} def __init__(self, xmlns=wsgi.XMLNS_V11): super(IPXMLSerializer, self).__init__(xmlns=xmlns) @@ -125,10 +125,6 @@ class IPXMLSerializer(wsgi.XMLDictSerializer): ip_elem.set('addr', ip_dict['addr']) return network_elem - def _to_xml(self, root): - """Convert the xml object to an xml string.""" - return etree.tostring(root, encoding='UTF-8') - def show(self, network_dict): (network_id, ip_dicts) = network_dict.items()[0] network = self._create_network_node(network_id, ip_dicts) diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index b978dea08..fa5b7c023 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -914,10 +914,6 @@ class ServerXMLSerializer(wsgi.XMLDictSerializer): elem.set('href', link['href']) return server_elem - def _to_xml(self, root): - """Convert the xml object to an xml string.""" - return etree.tostring(root, encoding='UTF-8') - def index(self, servers_dict): servers = etree.Element('servers', nsmap=self.NSMAP) for server_dict in servers_dict['servers']: diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 8641e960a..bdcadcb99 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -1,5 +1,6 @@ import json +from lxml import etree import webob from xml.dom import minidom from xml.parsers import expat @@ -392,6 +393,10 @@ class XMLDictSerializer(DictSerializer): link_nodes.append(link_node) return link_nodes + def _to_xml(self, root): + """Convert the xml object to an xml string.""" + return etree.tostring(root, encoding='UTF-8', xml_declaration=True) + class ResponseHeadersSerializer(ActionDispatcher): """Default response headers serialization""" |
