diff options
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 17 | 
1 files changed, 4 insertions, 13 deletions
| diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 3fd865f8..07fdddce 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -421,17 +421,8 @@ except ImportError:      yaml = None -# xml.etree.parse only throws ParseError for python >= 2.7 +# XML is optional  try: -    from xml.etree import ParseError as ETParseError -except ImportError:  # python < 2.7 -    ETParseError = None - - -# XMLParser only takes an encoding arg from >= 2.7 -def ET_XMLParser(encoding=None): -    from xml.etree import ElementTree as ET -    try: -        return ET.XMLParser(encoding=encoding) -    except TypeError: -        return ET.XMLParser() +    import defusedxml.ElementTree as etree +except ImportError: +    etree = None | 
