From d2487050b6e16d9bbb40d5f842793c44780635ec Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Mon, 25 Jun 2012 10:16:06 +0100 Subject: [PATCH] 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 --- heat/common/wsgi.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index 992870a72d..24d0d0cfce 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)