From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: Mariano Lopez <mariano.lopez@linux.intel.com>,
<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 7/8] oeqa.utils.metadata: have layer name as an attribute in xml
Date: Thu, 05 Jan 2017 11:35:54 +0200 [thread overview]
Message-ID: <D493DC33.6E785%markus.lehtonen@linux.intel.com> (raw)
In-Reply-To: <23139570-1257-66eb-482c-e2f438a11976@linux.intel.com>
On 04/01/2017, 17.43, "Mariano Lopez" <mariano.lopez@linux.intel.com>
wrote:
>
>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?
I don't think it's possible to make a nice generic json to xml converter.
The formats are just so different. I think the current method just
generates bad xml. In the future, it would probably be better to just get
rid of the json-to-xml conversion completely and make metadata_from_bb()
to directly return an ElementTree.
Thanks,
Markus
next prev parent reply other threads:[~2017-01-05 9:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-28 13:02 [PATCH 0/8] oeqa.utils.metadata: update xml schema Markus Lehtonen
2016-12-28 13:02 ` [PATCH 1/8] oeqa.utils.metadata: re-organise host distro information Markus Lehtonen
2016-12-28 13:02 ` [PATCH 2/8] oeqa.utils.metadata: re-organise " Markus Lehtonen
2016-12-28 13:02 ` [PATCH 3/8] oeqa.utils.metadata: drop 'unknown' git data elements Markus Lehtonen
2017-01-04 15:30 ` Mariano Lopez
2017-01-05 9:19 ` Markus Lehtonen
2016-12-28 13:02 ` [PATCH 4/8] oeqa.utils.metadata: fix retrieval of git branch and revision Markus Lehtonen
2016-12-28 13:02 ` [PATCH 5/8] oeqa.utils.metadata: rename 'revision' to 'commit' Markus Lehtonen
2016-12-28 13:02 ` [PATCH 6/8] oeqa.utils.metadata: add commit count information Markus Lehtonen
2016-12-28 13:02 ` [PATCH 7/8] oeqa.utils.metadata: have layer name as an attribute in xml Markus Lehtonen
2017-01-04 15:43 ` Mariano Lopez
2017-01-05 9:35 ` Markus Lehtonen [this message]
2016-12-28 13:02 ` [PATCH 8/8] oeqa.utils.metadata: add bitbake revision information Markus Lehtonen
2017-01-04 15:45 ` Mariano Lopez
2017-01-05 9:40 ` Markus Lehtonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D493DC33.6E785%markus.lehtonen@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=mariano.lopez@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox