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 <shardy@redhat.com>
This commit is contained in:
Steven Hardy 2012-06-25 10:16:06 +01:00
parent e09bd8e662
commit d2487050b6
1 changed files with 7 additions and 1 deletions

View File

@ -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)