From 3e8d8bb094b9f765d94ac033b9135bcb81b816d2 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 14 Jul 2012 14:33:13 -0700 Subject: [PATCH] Fixed auth to not use an internal implementation detail of SortedDict --- django/contrib/auth/forms.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index d2cb039e689..d17c41132ed 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django import forms from django.forms.util import flatatt from django.template import loader +from django.utils.datastructures import SortedDict from django.utils.html import format_html, format_html_join from django.utils.http import int_to_base36 from django.utils.safestring import mark_safe @@ -14,6 +15,7 @@ from django.contrib.auth.hashers import UNUSABLE_PASSWORD, is_password_usable, i from django.contrib.auth.tokens import default_token_generator from django.contrib.sites.models import get_current_site + UNMASKED_DIGITS_TO_SHOW = 6 mask_password = lambda p: "%s%s" % (p[:UNMASKED_DIGITS_TO_SHOW], "*" * max(len(p) - UNMASKED_DIGITS_TO_SHOW, 0)) @@ -293,8 +295,11 @@ class PasswordChangeForm(SetPasswordForm): raise forms.ValidationError( self.error_messages['password_incorrect']) return old_password -PasswordChangeForm.base_fields.keyOrder = ['old_password', 'new_password1', - 'new_password2'] + +PasswordChangeForm.base_fields = SortedDict([ + (k, PasswordChangeForm.base_fields[k]) + for k in ['old_password', 'new_password1', 'new_password2'] +]) class AdminPasswordChangeForm(forms.Form):