diff options
| author | Tom Christie | 2013-02-22 13:17:22 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-02-22 13:17:22 +0000 |
| commit | dcee027fa97f015ff3b87f0fd72b7995cdd6e155 (patch) | |
| tree | 676f581fe03c4a3e01d479756c590f75dc4aab4a /rest_framework/compat.py | |
| parent | b261515afa18a5d2a38d729b174bbd99ddee14ac (diff) | |
| download | django-rest-framework-dcee027fa97f015ff3b87f0fd72b7995cdd6e155.tar.bz2 | |
defusedxml for security fix.
As per:
http://blog.python.org/2013/02/announcing-defusedxml-fixes-for-xml.html
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 |
