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? -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core