Ticket #19807: 19807-1.diff

File 19807-1.diff, 1.9 KB (added by Claude Paroz, 12 years ago)
  • django/contrib/auth/management/commands/createsuperuser.py

    diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py
    index f462d95..ac2835d 100644
    a b class Command(BaseCommand):  
    122122                while password is None:
    123123                    if not password:
    124124                        password = getpass.getpass()
    125                         password2 = getpass.getpass('Password (again): ')
     125                        password2 = getpass.getpass(force_str('Password (again): '))
    126126                        if password != password2:
    127127                            self.stderr.write("Error: Your passwords didn't match.")
    128128                            password = None
  • django/contrib/auth/tests/basic.py

    diff --git a/django/contrib/auth/tests/basic.py b/django/contrib/auth/tests/basic.py
    index 03af1fd..3c7bcff 100644
    a b from django.core.management import call_command  
    1313from django.test import TestCase
    1414from django.test.utils import override_settings
    1515from django.utils.encoding import force_str
    16 from django.utils.six import StringIO
     16from django.utils.six import binary_type, StringIO
    1717
    1818
    1919def mock_inputs(inputs):
    def mock_inputs(inputs):  
    2424    def inner(test_func):
    2525        def wrapped(*args):
    2626            class mock_getpass:
    27                 pass
    28             mock_getpass.getpass = staticmethod(lambda p=None: inputs['password'])
     27                @staticmethod
     28                def getpass(prompt=b'Password: ', stream=None):
     29                    # getpass on Windows only supports prompt as bytestring (#19807)
     30                    assert isinstance(prompt, binary_type)
     31                    return inputs['password']
    2932
    3033            def mock_input(prompt):
    3134                # prompt should be encoded in Python 2. This line will raise an
Back to Top