diff options
| author | Tom Christie | 2012-02-22 04:54:31 -0800 |
|---|---|---|
| committer | Tom Christie | 2012-02-22 04:54:31 -0800 |
| commit | bc519cae5363d2f0fed92b2bc8963a9bd0930074 (patch) | |
| tree | 343c71e64f9bfbfb01fbe918c133a6d6ff6632b3 /djangorestframework/compat.py | |
| parent | 66eabe8bd1a539f92c3d677565d69edc29a1721b (diff) | |
| parent | 44b56ed059fa2963cf13ecdd4796b3ac45e800b6 (diff) | |
| download | django-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.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 |
