[OE-core] [PATCH 7/8] oeqa.utils.metadata: have layer name as an attribute in xml
Mariano Lopez
mariano.lopez at linux.intel.com
Wed Jan 4 15:43:05 UTC 2017
On 28/12/16 07:02, Markus Lehtonen wrote:
> -def dict_to_XML(tag, dictionary):
> +def dict_to_XML(tag, dictionary, **kwargs):
> """ Return XML element converting dicts recursively. """
>
> - elem = Element(tag)
> + elem = Element(tag, **kwargs)
> for key, val in dictionary.items():
> - if isinstance(val, MutableMapping):
> + if tag == 'layers':
> + child = (dict_to_XML('layer', val, name=key))
> + elif isinstance(val, MutableMapping):
> child = (dict_to_XML(key, val))
> else:
> child = Element(key)
I was thinking that this function would be more generic, adding a
comparison to a tag name surely won't keep the function generic, is
there another way to implement this keeping this function generic enough?
More information about the Openembedded-core
mailing list