mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Update xmltodict library 0.10.2 (375d3a6) → 0.11.0 (79ac9a4).
This commit is contained in:
parent
8be58de790
commit
cc69723261
2 changed files with 21 additions and 4 deletions
|
@ -21,6 +21,7 @@
|
|||
* Update Tornado Web Server 4.5.1 (79b2683) to 5.0.1 (35a538f)
|
||||
* Update unidecode library 0.04.21 (e99b0e3) to 1.0.22 (81f938d)
|
||||
* Update webencodings 0.5 (3970651) to 0.5.1 (fa2cb5d)
|
||||
* Update xmltodict library 0.10.2 (375d3a6) to 0.11.0 (79ac9a4)
|
||||
|
||||
[develop changelog]
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ except NameError: # pragma no cover
|
|||
_unicode = str
|
||||
|
||||
__author__ = 'Martin Blech'
|
||||
__version__ = '0.10.2'
|
||||
__version__ = '0.11.0'
|
||||
__license__ = 'MIT'
|
||||
|
||||
|
||||
|
@ -188,7 +188,7 @@ class _DictSAXHandler(object):
|
|||
|
||||
|
||||
def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
|
||||
namespace_separator=':', **kwargs):
|
||||
namespace_separator=':', disable_entities=True, **kwargs):
|
||||
"""Parse the given XML input and convert it into a dictionary.
|
||||
|
||||
`xml_input` can either be a `string` or a file-like object.
|
||||
|
@ -313,9 +313,20 @@ def parse(xml_input, encoding=None, expat=expat, process_namespaces=False,
|
|||
parser.EndElementHandler = handler.endElement
|
||||
parser.CharacterDataHandler = handler.characters
|
||||
parser.buffer_text = True
|
||||
try:
|
||||
if disable_entities:
|
||||
try:
|
||||
# Attempt to disable DTD in Jython's expat parser (Xerces-J).
|
||||
feature = "http://apache.org/xml/features/disallow-doctype-decl"
|
||||
parser._reader.setFeature(feature, True)
|
||||
except AttributeError:
|
||||
# For CPython / expat parser.
|
||||
# Anything not handled ends up here and entities aren't expanded.
|
||||
parser.DefaultHandler = lambda x: None
|
||||
# Expects an integer return; zero means failure -> expat.ExpatError.
|
||||
parser.ExternalEntityRefHandler = lambda *x: 1
|
||||
if hasattr(xml_input, 'read'):
|
||||
parser.ParseFile(xml_input)
|
||||
except (TypeError, AttributeError):
|
||||
else:
|
||||
parser.Parse(xml_input, True)
|
||||
return handler.item
|
||||
|
||||
|
@ -361,6 +372,11 @@ def _emit(key, value, content_handler,
|
|||
raise ValueError('document with multiple roots')
|
||||
if v is None:
|
||||
v = OrderedDict()
|
||||
elif isinstance(v, bool):
|
||||
if v:
|
||||
v = _unicode('true')
|
||||
else:
|
||||
v = _unicode('false')
|
||||
elif not isinstance(v, dict):
|
||||
v = _unicode(v)
|
||||
if isinstance(v, _basestring):
|
||||
|
|
Loading…
Reference in a new issue