aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/compat.py
diff options
context:
space:
mode:
authorTom Christie2012-02-22 04:54:31 -0800
committerTom Christie2012-02-22 04:54:31 -0800
commitbc519cae5363d2f0fed92b2bc8963a9bd0930074 (patch)
tree343c71e64f9bfbfb01fbe918c133a6d6ff6632b3 /djangorestframework/compat.py
parent66eabe8bd1a539f92c3d677565d69edc29a1721b (diff)
parent44b56ed059fa2963cf13ecdd4796b3ac45e800b6 (diff)
downloaddjango-rest-framework-bc519cae5363d2f0fed92b2bc8963a9bd0930074.tar.bz2
Merge pull request #176 from tschan/master
Add exception handling to the XML parser
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