diff options
| author | Curtis Maloney <curtis@tinbrain.net> | 2013-08-03 15:41:15 +1000 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-04 07:09:39 -0400 |
| commit | 07876cf02b6db453ca0397c29c225668872fa96d (patch) | |
| tree | 2a27c0e5e6ea67e8736547b42e29c9f43af5433e /django/utils | |
| parent | b278f7478d37d3620e5addf7cc2070bc38c10871 (diff) | |
Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/datastructures.py | 6 | ||||
| -rw-r--r-- | django/utils/translation/trans_real.py | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 3b1638392c..d6447ec0c7 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -1,7 +1,7 @@ import copy +import warnings from django.utils import six - class MergeDict(object): """ A simple class for creating new "virtual" dictionaries that actually look @@ -124,6 +124,10 @@ class SortedDict(dict): return instance def __init__(self, data=None): + warnings.warn( + "SortedDict is deprecated and will be removed in Django 1.9.", + PendingDeprecationWarning, stacklevel=2 + ) if data is None or isinstance(data, dict): data = data or [] super(SortedDict, self).__init__(data) diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index 91a73f1e68..11463d8f9b 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -1,6 +1,7 @@ """Translation helper functions.""" from __future__ import unicode_literals +from collections import OrderedDict import locale import os import re @@ -10,7 +11,6 @@ from importlib import import_module from threading import local import warnings -from django.utils.datastructures import SortedDict from django.utils.encoding import force_str, force_text from django.utils.functional import memoize from django.utils._os import upath @@ -369,7 +369,7 @@ def get_supported_language_variant(lang_code, supported=None, strict=False): """ if supported is None: from django.conf import settings - supported = SortedDict(settings.LANGUAGES) + supported = OrderedDict(settings.LANGUAGES) if lang_code: # if fr-CA is not supported, try fr-ca; if that fails, fallback to fr. generic_lang_code = lang_code.split('-')[0] @@ -396,7 +396,7 @@ def get_language_from_path(path, supported=None, strict=False): """ if supported is None: from django.conf import settings - supported = SortedDict(settings.LANGUAGES) + supported = OrderedDict(settings.LANGUAGES) regex_match = language_code_prefix_re.match(path) if not regex_match: return None @@ -418,7 +418,7 @@ def get_language_from_request(request, check_path=False): """ global _accepted from django.conf import settings - supported = SortedDict(settings.LANGUAGES) + supported = OrderedDict(settings.LANGUAGES) if check_path: lang_code = get_language_from_path(request.path_info, supported) |
