Zimbra-Community / python-zimbra

Core framework for easily sending requests to the Zimbra SOAP-API
BSD 2-Clause "Simplified" License
63 stars 26 forks source link

Bugfix for handling of lists when creating xml #38

Open flokflok opened 1 year ago

flokflok commented 1 year ago

Hey, the dict_to_dom() method does not correctly handle Python lists. Instead of creating one root element and the sub-elements in it, the root element is repeated for each sub-element.

Example dict:

{
    "a": [
        {
            "b": {
                "id": 1
            }
        },
        {
            "b": {
                "id": 2
            }
        }
    ]
}

Actual result:

<a>
  <b id="1"/>
</a>
<a>
  <b id="2"/>
</a>

Expected result:

<a>
  <b id="1"/>
  <b id="2"/>
</a>

This pull request ought to fix this. Thanks.