diff options
| author | Tom Christie | 2014-11-06 12:00:30 +0000 | 
|---|---|---|
| committer | Tom Christie | 2014-11-06 12:00:30 +0000 | 
| commit | 4e001dbb7ac0bc13d6d5fbb4524e905184610aa2 (patch) | |
| tree | f653aa5d1e0eaff780ba52039f29085e4bc8f54c /rest_framework/compat.py | |
| parent | 9923a6ce9013693ea1723e7895b3cab638d719fd (diff) | |
| download | django-rest-framework-4e001dbb7ac0bc13d6d5fbb4524e905184610aa2.tar.bz2 | |
Drop usage of SortedDict. Closes #2027.
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 10 | 
1 files changed, 10 insertions, 0 deletions
| diff --git a/rest_framework/compat.py b/rest_framework/compat.py index 0201bd83..5bd85e74 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -26,6 +26,16 @@ except ImportError:      from django.utils.encoding import force_unicode as force_text +# OrderedDict only available in Python 2.7. +# This will always be the case in Django 1.7 and above, as these versions +# no longer support Python 2.6. +# For Django <= 1.6 and Python 2.6 fall back to OrderedDict. +try: +    from collections import OrderedDict +except: +    from django.utils.datastructures import SortedDict as OrderedDict + +  # HttpResponseBase only exists from 1.5 onwards  try:      from django.http.response import HttpResponseBase | 
