From 162b9651c3e251d8acae764f08372f764597f8ca Mon Sep 17 00:00:00 2001 From: Alex Meade Date: Thu, 7 Jul 2011 14:27:27 -0400 Subject: Added param to keep current things from breaking until we update all of the xml serializers and view builders to reflect the current spec --- nova/api/openstack/images.py | 8 ++++---- nova/api/openstack/wsgi.py | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/nova/api/openstack/images.py b/nova/api/openstack/images.py index c540037fa..8f75fae4c 100644 --- a/nova/api/openstack/images.py +++ b/nova/api/openstack/images.py @@ -327,26 +327,26 @@ class ImageXMLSerializer(wsgi.XMLDictSerializer): node = self._image_list_to_xml(xml_doc, images_dict['images'], detailed=False) - return self.xml_string(node) + return self.xml_string(node, True) def detail(self, images_dict): xml_doc = minidom.Document() node = self._image_list_to_xml(xml_doc, images_dict['images'], detailed=True) - return self.xml_string(node) + return self.xml_string(node, True) def show(self, image_dict): xml_doc = minidom.Document() node = self._image_to_xml_detailed(xml_doc, image_dict['image']) - return self.xml_string(node) + return self.xml_string(node, True) def create(self, image_dict): xml_doc = minidom.Document() node = self._image_to_xml_detailed(xml_doc, image_dict['image']) - return self.xml_string(node) + return self.xml_string(node, True) def create_resource(version='1.0'): diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index 693c85b97..4ac7b56c9 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -232,18 +232,19 @@ class XMLDictSerializer(DictSerializer): doc = minidom.Document() node = self._to_xml_node(doc, self.metadata, root_key, data[root_key]) - self._add_xmlns(node) + return self.xml_string(node) - return node.toprettyxml(indent=' ', encoding='utf-8') - - def xml_string(self, node): - self._add_xmlns(node) + def xml_string(self, node, has_atom=False): + self._add_xmlns(node, has_atom) return node.toprettyxml(indent=' ', encoding='UTF-8') - def _add_xmlns(self, node): + #NOTE (ameade): the has_atom should be removed after all of the + # xml serializers and view builders have been updated + def _add_xmlns(self, node, has_atom=False): if self.xmlns is not None: node.setAttribute('xmlns', self.xmlns) - node.setAttribute('xmlns:atom', "http://www.w3.org/2005/Atom") + if has_atom: + node.setAttribute('xmlns:atom', "http://www.w3.org/2005/Atom") def _to_xml_node(self, doc, metadata, nodename, data): """Recursive method to convert data members to XML nodes.""" -- cgit