diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2012-07-14 16:08:42 -0700 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2012-07-14 16:08:42 -0700 |
| commit | 8b3c2f2c51183bde47bd1e98057b77866f35dd6e (patch) | |
| tree | 373140af1f9ebe955cf7d052f74c1b4f988938a3 /django/utils/datastructures.py | |
| parent | 9877d25dc67b9c852e1a69ece6153894d4c9d1d1 (diff) | |
Deprecate two methods (which I seriously doubt anyone ever used, but they were documented so...) because they cannot be implemented efficiently on top of collections.SortedDict in Python 2.7 and up.
Diffstat (limited to 'django/utils/datastructures.py')
| -rw-r--r-- | django/utils/datastructures.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 9a41b4311c..832b16c3d4 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -1,6 +1,8 @@ import copy +import warning from types import GeneratorType + class MergeDict(object): """ A simple class for creating new "virtual" dictionaries that actually look @@ -191,10 +193,17 @@ class SortedDict(dict): def value_for_index(self, index): """Returns the value of the item at the given zero-based index.""" + # This, and insert() are deprecated because they cannot be implemented + # using collections.OrderedDict (Python 2.7 and up), which we'll + # eventually switch to + warning.warn(PendingDeprecationWarning, + "SortedDict.value_for_index is deprecated", stacklevel=2) return self[self.keyOrder[index]] def insert(self, index, key, value): """Inserts the key, value pair before the item with the given index.""" + warning.warn(PendingDeprecationWarning, + "SortedDict.insert is deprecated", stacklevel=2) if key in self.keyOrder: n = self.keyOrder.index(key) del self.keyOrder[n] |
