Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SickRage-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
SickRage-1
Commits
1c280eb6
Commit
1c280eb6
authored
Oct 10, 2015
by
Fernando
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Update xmltodict to v 0.9.2"
parent
cb4a9166
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/xmltodict.py
+9
-15
9 additions, 15 deletions
lib/xmltodict.py
with
9 additions
and
15 deletions
lib/xmltodict.py
+
9
−
15
View file @
1c280eb6
...
@@ -29,7 +29,7 @@ except NameError: # pragma no cover
...
@@ -29,7 +29,7 @@ except NameError: # pragma no cover
_unicode
=
str
_unicode
=
str
__author__
=
'
Martin Blech
'
__author__
=
'
Martin Blech
'
__version__
=
'
0.9.
2
'
__version__
=
'
0.9.
0
'
__license__
=
'
MIT
'
__license__
=
'
MIT
'
...
@@ -94,7 +94,7 @@ class _DictSAXHandler(object):
...
@@ -94,7 +94,7 @@ class _DictSAXHandler(object):
self
.
stack
.
append
((
self
.
item
,
self
.
data
))
self
.
stack
.
append
((
self
.
item
,
self
.
data
))
if
self
.
xml_attribs
:
if
self
.
xml_attribs
:
attrs
=
self
.
dict_constructor
(
attrs
=
self
.
dict_constructor
(
(
self
.
attr_prefix
+
self
.
_build_name
(
key
)
,
value
)
(
self
.
attr_prefix
+
key
,
value
)
for
(
key
,
value
)
in
attrs
.
items
())
for
(
key
,
value
)
in
attrs
.
items
())
else
:
else
:
attrs
=
None
attrs
=
None
...
@@ -256,20 +256,17 @@ def _emit(key, value, content_handler,
...
@@ -256,20 +256,17 @@ def _emit(key, value, content_handler,
preprocessor=None,
preprocessor=None,
pretty=False,
pretty=False,
newl=
'
\n
'
,
newl=
'
\n
'
,
indent=
'
\t
'
,
indent=
'
\t
'
):
full_document=True):
if preprocessor is not None:
if preprocessor is not None:
result = preprocessor(key, value)
result = preprocessor(key, value)
if result is None:
if result is None:
return
return
key, value = result
key, value = result
if (not hasattr(value,
'
__iter__
'
)
if not isinstance(value, (list, tuple)):
or isinstance(value, _basestring)
or isinstance(value, dict)):
value = [value]
value = [value]
for index, v in enumerate(value):
if depth == 0 and len(value) > 1:
if full_document and depth == 0 and index > 0:
raise ValueError(
'
document with multiple roots
'
)
raise ValueError(
'
document with multiple roots
'
)
for v in value:
if v is None:
if v is None:
v = OrderedDict()
v = OrderedDict()
elif not isinstance(v, dict):
elif not isinstance(v, dict):
...
@@ -321,8 +318,7 @@ def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
...
@@ -321,8 +318,7 @@ def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
can be customized with the `newl` and `indent` parameters.
can be customized with the `newl` and `indent` parameters.
"""
"""
if full_document and len(input_dict) != 1:
((key, value),) = input_dict.items()
raise ValueError(
'
Document must have exactly one root.
'
)
must_return = False
must_return = False
if output is None:
if output is None:
output = StringIO()
output = StringIO()
...
@@ -330,9 +326,7 @@ def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
...
@@ -330,9 +326,7 @@ def unparse(input_dict, output=None, encoding='utf-8', full_document=True,
content_handler = XMLGenerator(output, encoding)
content_handler = XMLGenerator(output, encoding)
if full_document:
if full_document:
content_handler.startDocument()
content_handler.startDocument()
for key, value in input_dict.items():
_emit(key, value, content_handler, **kwargs)
_emit(key, value, content_handler, full_document=full_document,
**kwargs)
if full_document:
if full_document:
content_handler.endDocument()
content_handler.endDocument()
if must_return:
if must_return:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment