From: Steven Hardy Date: Mon, 25 Jun 2012 09:16:06 +0000 (+0100) Subject: heat API : Escape JSON TemplateBody XML serialization X-Git-Tag: 2014.1~1679 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=d2487050b6e16d9bbb40d5f842793c44780635ec;p=openstack-build%2Fheat-build.git heat API : Escape JSON TemplateBody XML serialization AWS API defines JSON templates returned inside XML "wrapper" this change escapes XML serialization of TemplateBody content ref #152 Change-Id: I7e38dd2010b03061979f0906b582f9461c85cabc Signed-off-by: Steven Hardy --- diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index 992870a7..24d0d0cf 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -446,7 +446,13 @@ class XMLResponseSerializer(object): elif isinstance(obj, dict): for key, value in obj.items(): subelement = etree.SubElement(element, key) - self.object_to_element(value, subelement) + if key == "TemplateBody": + # Escape serialization for TemplateBody key, as + # AWS api defines JSON-template-inside-XML format + # ref to GetTemplate AWS CFN API docs + subelement.text = str(value) + else: + self.object_to_element(value, subelement) else: element.text = str(obj)