diff options
| author | Tom Christie | 2013-02-22 11:49:57 -0800 |
|---|---|---|
| committer | Tom Christie | 2013-02-22 11:49:57 -0800 |
| commit | cf6c95de0112eb7d1c524849e907b586513cdf63 (patch) | |
| tree | afb8c1b3fb18fba9af370e7afffd7458d730d7c3 /rest_framework/compat.py | |
| parent | a39de47cc7e6861a1d06b8ab1893f7358cf281f9 (diff) | |
| parent | 78da724964019e33bfa5d9f05db2806d85816c2d (diff) | |
| download | django-rest-framework-cf6c95de0112eb7d1c524849e907b586513cdf63.tar.bz2 | |
Merge pull request #673 from tomchristie/defusedxml
XML Security fixes
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 |
