aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/compat.py
diff options
context:
space:
mode:
authorCan Yavuz2012-02-22 11:17:37 +0100
committerCan Yavuz2012-02-22 11:17:37 +0100
commit44b56ed059fa2963cf13ecdd4796b3ac45e800b6 (patch)
tree343c71e64f9bfbfb01fbe918c133a6d6ff6632b3 /djangorestframework/compat.py
parent66eabe8bd1a539f92c3d677565d69edc29a1721b (diff)
downloaddjango-rest-framework-44b56ed059fa2963cf13ecdd4796b3ac45e800b6.tar.bz2
let the XML parser fail gracefully on malformed XML
Diffstat (limited to 'djangorestframework/compat.py')
-rw-r--r--djangorestframework/compat.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/djangorestframework/compat.py b/djangorestframework/compat.py
index b818b446..e81b428f 100644
--- a/djangorestframework/compat.py
+++ b/djangorestframework/compat.py
@@ -465,3 +465,9 @@ except:
from django.core.urlresolvers import reverse
from django.utils.functional import lazy
reverse_lazy = lazy(reverse, str)
+
+# xml.etree.parse only throws ParseError for python >= 2.7
+try:
+ from xml.etree import ParseError as ETParseError
+except ImportError: # python < 2.7
+ ETParseError = None