Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
17
Merge Requests
17
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
1d5b167c
Commit
1d5b167c
authored
Oct 01, 2019
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
squash! Synchronise xml2dict and dict2xml
Stabilise generated XMLs by sorting the dictionary.
parent
7cc4d3ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
slapos/tests/test_util.py
slapos/tests/test_util.py
+4
-4
slapos/util.py
slapos/util.py
+1
-1
No files found.
slapos/tests/test_util.py
View file @
1d5b167c
...
...
@@ -123,14 +123,14 @@ class TestUtil(unittest.TestCase):
xml2dict_xml
=
slapos
.
util
.
bytes2str
(
b"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="badstr">
\
xc5
\
x81
</parameter>
<parameter id="badu">
\
xc5
\
x81
</parameter>
<parameter id="emptystr"></parameter>
<parameter id="int">1</parameter>
<parameter id="intstr">1</parameter>
<parameter id="key">str</parameter>
<parameter id="ukey">ustr</parameter>
<parameter id="int">1</parameter>
<parameter id="list">[
\
'
one
\
'
, 2]</parameter>
<parameter id="emptystr"></parameter>
<parameter id="none">None</parameter>
<parameter id="
badu">
\
xc5
\
x81
</parameter>
<parameter id="
ukey">ustr
</parameter>
</instance>
"""
)
...
...
slapos/util.py
View file @
1d5b167c
...
...
@@ -153,7 +153,7 @@ else:
def
dict2xml
(
dictionary
):
instance
=
etree
.
Element
(
'instance'
)
for
k
,
v
in
s
ix
.
iteritems
(
dictionary
):
for
k
,
v
in
s
orted
(
six
.
iteritems
(
dictionary
)
):
if
isinstance
(
k
,
bytes
):
k
=
k
.
decode
(
'utf-8'
)
if
isinstance
(
v
,
bytes
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment