Browse Source

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>
changes/31/231/1
Steven Hardy 10 years ago
parent
commit
d2487050b6
  1. 8
      heat/common/wsgi.py

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

Loading…
Cancel
Save