diff options
| author | Can Yavuz | 2012-02-22 11:17:37 +0100 |
|---|---|---|
| committer | Can Yavuz | 2012-02-22 11:17:37 +0100 |
| commit | 44b56ed059fa2963cf13ecdd4796b3ac45e800b6 (patch) | |
| tree | 343c71e64f9bfbfb01fbe918c133a6d6ff6632b3 /djangorestframework/compat.py | |
| parent | 66eabe8bd1a539f92c3d677565d69edc29a1721b (diff) | |
| download | django-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.py | 6 |
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 |
