Loading django/contrib/admin/options.py +4 −4 Original line number Diff line number Diff line from collections import OrderedDict import copy import operator from functools import partial, reduce, update_wrapper Loading Loading @@ -29,7 +30,6 @@ from django.http.response import HttpResponseBase from django.shortcuts import get_object_or_404 from django.template.response import SimpleTemplateResponse, TemplateResponse from django.utils.decorators import method_decorator from django.utils.datastructures import SortedDict from django.utils.html import escape, escapejs from django.utils.safestring import mark_safe from django.utils import six Loading Loading @@ -672,7 +672,7 @@ class ModelAdmin(BaseModelAdmin): # want *any* actions enabled on this page. from django.contrib.admin.views.main import _is_changelist_popup if self.actions is None or _is_changelist_popup(request): return SortedDict() return OrderedDict() actions = [] Loading @@ -693,8 +693,8 @@ class ModelAdmin(BaseModelAdmin): # get_action might have returned None, so filter any of those out. actions = filter(None, actions) # Convert the actions into a SortedDict keyed by name. actions = SortedDict([ # Convert the actions into an OrderedDict keyed by name. actions = OrderedDict([ (name, (func, name, desc)) for func, name, desc in actions ]) Loading django/contrib/admin/views/main.py +3 −3 Original line number Diff line number Diff line from collections import OrderedDict import sys import warnings Loading @@ -7,7 +8,6 @@ from django.core.urlresolvers import reverse from django.db import models from django.db.models.fields import FieldDoesNotExist from django.utils import six from django.utils.datastructures import SortedDict from django.utils.deprecation import RenameMethodsBase from django.utils.encoding import force_str, force_text from django.utils.translation import ugettext, ugettext_lazy Loading Loading @@ -319,13 +319,13 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): def get_ordering_field_columns(self): """ Returns a SortedDict of ordering field column numbers and asc/desc Returns an OrderedDict of ordering field column numbers and asc/desc """ # We must cope with more than one column having the same underlying sort # field, so we base things on column numbers. ordering = self._get_default_ordering() ordering_fields = SortedDict() ordering_fields = OrderedDict() if ORDER_VAR not in self.params: # for ordering specified on ModelAdmin or model Meta, we don't know # the right column numbers absolutely, because there might be more Loading django/contrib/auth/forms.py +3 −2 Original line number Diff line number Diff line from __future__ import unicode_literals from collections import OrderedDict from django import forms from django.forms.util import flatatt from django.template import loader from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes from django.utils.html import format_html, format_html_join from django.utils.http import urlsafe_base64_encode Loading Loading @@ -324,7 +325,7 @@ class PasswordChangeForm(SetPasswordForm): ) return old_password PasswordChangeForm.base_fields = SortedDict([ PasswordChangeForm.base_fields = OrderedDict([ (k, PasswordChangeForm.base_fields[k]) for k in ['old_password', 'new_password1', 'new_password2'] ]) Loading django/contrib/auth/hashers.py +8 −8 Original line number Diff line number Diff line Loading @@ -2,13 +2,13 @@ from __future__ import unicode_literals import base64 import binascii from collections import OrderedDict import hashlib import importlib from django.dispatch import receiver from django.conf import settings from django.test.signals import setting_changed from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes, force_str, force_text from django.core.exceptions import ImproperlyConfigured from django.utils.crypto import ( Loading Loading @@ -243,7 +243,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, iterations, salt, hash = encoded.split('$', 3) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('iterations'), iterations), (_('salt'), mask_hash(salt)), Loading Loading @@ -320,7 +320,7 @@ class BCryptSHA256PasswordHasher(BasePasswordHasher): algorithm, empty, algostr, work_factor, data = encoded.split('$', 4) assert algorithm == self.algorithm salt, checksum = data[:22], data[22:] return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('work factor'), work_factor), (_('salt'), mask_hash(salt)), Loading Loading @@ -368,7 +368,7 @@ class SHA1PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), Loading Loading @@ -396,7 +396,7 @@ class MD5PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), Loading Loading @@ -429,7 +429,7 @@ class UnsaltedSHA1PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): assert encoded.startswith('sha1$$') hash = encoded[6:] return SortedDict([ return OrderedDict([ (_('algorithm'), self.algorithm), (_('hash'), mask_hash(hash)), ]) Loading Loading @@ -462,7 +462,7 @@ class UnsaltedMD5PasswordHasher(BasePasswordHasher): return constant_time_compare(encoded, encoded_2) def safe_summary(self, encoded): return SortedDict([ return OrderedDict([ (_('algorithm'), self.algorithm), (_('hash'), mask_hash(encoded, show=3)), ]) Loading Loading @@ -496,7 +496,7 @@ class CryptPasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, data = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), salt), (_('hash'), mask_hash(data, show=3)), Loading django/contrib/formtools/wizard/views.py +11 −9 Original line number Diff line number Diff line from collections import OrderedDict import re from django import forms Loading @@ -5,7 +6,6 @@ from django.shortcuts import redirect from django.core.urlresolvers import reverse from django.forms import formsets, ValidationError from django.views.generic import TemplateView from django.utils.datastructures import SortedDict from django.utils.decorators import classonlymethod from django.utils.translation import ugettext as _ from django.utils import six Loading Loading @@ -158,7 +158,7 @@ class WizardView(TemplateView): form_list = form_list or kwargs.pop('form_list', getattr(cls, 'form_list', None)) or [] computed_form_list = SortedDict() computed_form_list = OrderedDict() assert len(form_list) > 0, 'at least one form is needed' Loading Loading @@ -206,7 +206,7 @@ class WizardView(TemplateView): The form_list is always generated on the fly because condition methods could use data from other (maybe previous forms). """ form_list = SortedDict() form_list = OrderedDict() for form_key, form_class in six.iteritems(self.form_list): # try to fetch the value from condition list, by default, the form # gets passed to the new list. Loading Loading @@ -498,9 +498,10 @@ class WizardView(TemplateView): if step is None: step = self.steps.current form_list = self.get_form_list() key = form_list.keyOrder.index(step) + 1 if len(form_list.keyOrder) > key: return form_list.keyOrder[key] keys = list(form_list.keys()) key = keys.index(step) + 1 if len(keys) > key: return keys[key] return None def get_prev_step(self, step=None): Loading @@ -512,9 +513,10 @@ class WizardView(TemplateView): if step is None: step = self.steps.current form_list = self.get_form_list() key = form_list.keyOrder.index(step) - 1 keys = list(form_list.keys()) key = keys.index(step) - 1 if key >= 0: return form_list.keyOrder[key] return keys[key] return None def get_step_index(self, step=None): Loading @@ -524,7 +526,7 @@ class WizardView(TemplateView): """ if step is None: step = self.steps.current return self.get_form_list().keyOrder.index(step) return list(self.get_form_list().keys()).index(step) def get_context_data(self, form, **kwargs): """ Loading Loading
django/contrib/admin/options.py +4 −4 Original line number Diff line number Diff line from collections import OrderedDict import copy import operator from functools import partial, reduce, update_wrapper Loading Loading @@ -29,7 +30,6 @@ from django.http.response import HttpResponseBase from django.shortcuts import get_object_or_404 from django.template.response import SimpleTemplateResponse, TemplateResponse from django.utils.decorators import method_decorator from django.utils.datastructures import SortedDict from django.utils.html import escape, escapejs from django.utils.safestring import mark_safe from django.utils import six Loading Loading @@ -672,7 +672,7 @@ class ModelAdmin(BaseModelAdmin): # want *any* actions enabled on this page. from django.contrib.admin.views.main import _is_changelist_popup if self.actions is None or _is_changelist_popup(request): return SortedDict() return OrderedDict() actions = [] Loading @@ -693,8 +693,8 @@ class ModelAdmin(BaseModelAdmin): # get_action might have returned None, so filter any of those out. actions = filter(None, actions) # Convert the actions into a SortedDict keyed by name. actions = SortedDict([ # Convert the actions into an OrderedDict keyed by name. actions = OrderedDict([ (name, (func, name, desc)) for func, name, desc in actions ]) Loading
django/contrib/admin/views/main.py +3 −3 Original line number Diff line number Diff line from collections import OrderedDict import sys import warnings Loading @@ -7,7 +8,6 @@ from django.core.urlresolvers import reverse from django.db import models from django.db.models.fields import FieldDoesNotExist from django.utils import six from django.utils.datastructures import SortedDict from django.utils.deprecation import RenameMethodsBase from django.utils.encoding import force_str, force_text from django.utils.translation import ugettext, ugettext_lazy Loading Loading @@ -319,13 +319,13 @@ class ChangeList(six.with_metaclass(RenameChangeListMethods)): def get_ordering_field_columns(self): """ Returns a SortedDict of ordering field column numbers and asc/desc Returns an OrderedDict of ordering field column numbers and asc/desc """ # We must cope with more than one column having the same underlying sort # field, so we base things on column numbers. ordering = self._get_default_ordering() ordering_fields = SortedDict() ordering_fields = OrderedDict() if ORDER_VAR not in self.params: # for ordering specified on ModelAdmin or model Meta, we don't know # the right column numbers absolutely, because there might be more Loading
django/contrib/auth/forms.py +3 −2 Original line number Diff line number Diff line from __future__ import unicode_literals from collections import OrderedDict from django import forms from django.forms.util import flatatt from django.template import loader from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes from django.utils.html import format_html, format_html_join from django.utils.http import urlsafe_base64_encode Loading Loading @@ -324,7 +325,7 @@ class PasswordChangeForm(SetPasswordForm): ) return old_password PasswordChangeForm.base_fields = SortedDict([ PasswordChangeForm.base_fields = OrderedDict([ (k, PasswordChangeForm.base_fields[k]) for k in ['old_password', 'new_password1', 'new_password2'] ]) Loading
django/contrib/auth/hashers.py +8 −8 Original line number Diff line number Diff line Loading @@ -2,13 +2,13 @@ from __future__ import unicode_literals import base64 import binascii from collections import OrderedDict import hashlib import importlib from django.dispatch import receiver from django.conf import settings from django.test.signals import setting_changed from django.utils.datastructures import SortedDict from django.utils.encoding import force_bytes, force_str, force_text from django.core.exceptions import ImproperlyConfigured from django.utils.crypto import ( Loading Loading @@ -243,7 +243,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, iterations, salt, hash = encoded.split('$', 3) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('iterations'), iterations), (_('salt'), mask_hash(salt)), Loading Loading @@ -320,7 +320,7 @@ class BCryptSHA256PasswordHasher(BasePasswordHasher): algorithm, empty, algostr, work_factor, data = encoded.split('$', 4) assert algorithm == self.algorithm salt, checksum = data[:22], data[22:] return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('work factor'), work_factor), (_('salt'), mask_hash(salt)), Loading Loading @@ -368,7 +368,7 @@ class SHA1PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), Loading Loading @@ -396,7 +396,7 @@ class MD5PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, hash = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), mask_hash(salt, show=2)), (_('hash'), mask_hash(hash)), Loading Loading @@ -429,7 +429,7 @@ class UnsaltedSHA1PasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): assert encoded.startswith('sha1$$') hash = encoded[6:] return SortedDict([ return OrderedDict([ (_('algorithm'), self.algorithm), (_('hash'), mask_hash(hash)), ]) Loading Loading @@ -462,7 +462,7 @@ class UnsaltedMD5PasswordHasher(BasePasswordHasher): return constant_time_compare(encoded, encoded_2) def safe_summary(self, encoded): return SortedDict([ return OrderedDict([ (_('algorithm'), self.algorithm), (_('hash'), mask_hash(encoded, show=3)), ]) Loading Loading @@ -496,7 +496,7 @@ class CryptPasswordHasher(BasePasswordHasher): def safe_summary(self, encoded): algorithm, salt, data = encoded.split('$', 2) assert algorithm == self.algorithm return SortedDict([ return OrderedDict([ (_('algorithm'), algorithm), (_('salt'), salt), (_('hash'), mask_hash(data, show=3)), Loading
django/contrib/formtools/wizard/views.py +11 −9 Original line number Diff line number Diff line from collections import OrderedDict import re from django import forms Loading @@ -5,7 +6,6 @@ from django.shortcuts import redirect from django.core.urlresolvers import reverse from django.forms import formsets, ValidationError from django.views.generic import TemplateView from django.utils.datastructures import SortedDict from django.utils.decorators import classonlymethod from django.utils.translation import ugettext as _ from django.utils import six Loading Loading @@ -158,7 +158,7 @@ class WizardView(TemplateView): form_list = form_list or kwargs.pop('form_list', getattr(cls, 'form_list', None)) or [] computed_form_list = SortedDict() computed_form_list = OrderedDict() assert len(form_list) > 0, 'at least one form is needed' Loading Loading @@ -206,7 +206,7 @@ class WizardView(TemplateView): The form_list is always generated on the fly because condition methods could use data from other (maybe previous forms). """ form_list = SortedDict() form_list = OrderedDict() for form_key, form_class in six.iteritems(self.form_list): # try to fetch the value from condition list, by default, the form # gets passed to the new list. Loading Loading @@ -498,9 +498,10 @@ class WizardView(TemplateView): if step is None: step = self.steps.current form_list = self.get_form_list() key = form_list.keyOrder.index(step) + 1 if len(form_list.keyOrder) > key: return form_list.keyOrder[key] keys = list(form_list.keys()) key = keys.index(step) + 1 if len(keys) > key: return keys[key] return None def get_prev_step(self, step=None): Loading @@ -512,9 +513,10 @@ class WizardView(TemplateView): if step is None: step = self.steps.current form_list = self.get_form_list() key = form_list.keyOrder.index(step) - 1 keys = list(form_list.keys()) key = keys.index(step) - 1 if key >= 0: return form_list.keyOrder[key] return keys[key] return None def get_step_index(self, step=None): Loading @@ -524,7 +526,7 @@ class WizardView(TemplateView): """ if step is None: step = self.steps.current return self.get_form_list().keyOrder.index(step) return list(self.get_form_list().keys()).index(step) def get_context_data(self, form, **kwargs): """ Loading