Recursively replace all : with . in Output keys.

This is needed so that some Quantum properties with colons in the keys are not
interpreted as xml namespaces.

Change-Id: Iba5290a408595b2f028744c10315daac29da055e
This commit is contained in:
Steve Baker 2012-11-02 17:07:47 +13:00
parent 499e492d94
commit b3a57062ad
1 changed files with 16 additions and 1 deletions

View File

@ -148,7 +148,22 @@ class StackController(object):
engine_api.OUTPUT_VALUE: 'OutputValue',
}
return api_utils.reformat_dict_keys(keymap, o)
def replacecolon(d):
return dict(map(lambda (k, v):
(k.replace(':', '.'), v), d.items()))
def transform(attrs):
"""
Recursively replace all : with . in dict keys
so that they are not interpreted as xml namespaces.
"""
new = replacecolon(attrs)
for key, value in new.items():
if isinstance(value, dict):
new[key] = transform(value)
return new
return api_utils.reformat_dict_keys(keymap, transform(o))
def format_stack(s):
"""