Kaydet (Commit) 9581ac39 authored tarafından Tzu-ping Chung's avatar Tzu-ping Chung Kaydeden (comit) Tim Graham

[1.9.x] Fixed #25457 -- Improved formatting of password validation errors in…

[1.9.x] Fixed #25457 -- Improved formatting of password validation errors in management command output.

Backport of 7372cdeb from master
üst 9b5f1880
...@@ -60,7 +60,7 @@ class Command(BaseCommand): ...@@ -60,7 +60,7 @@ class Command(BaseCommand):
try: try:
validate_password(p2, u) validate_password(p2, u)
except ValidationError as err: except ValidationError as err:
self.stdout.write(', '.join(err.messages)) self.stderr.write('\n'.join(err.messages))
count += 1 count += 1
else: else:
password_validated = True password_validated = True
......
...@@ -153,7 +153,7 @@ class Command(BaseCommand): ...@@ -153,7 +153,7 @@ class Command(BaseCommand):
try: try:
validate_password(password2, self.UserModel(**fake_user_data)) validate_password(password2, self.UserModel(**fake_user_data))
except exceptions.ValidationError as err: except exceptions.ValidationError as err:
self.stderr.write(', '.join(err.messages)) self.stderr.write('\n'.join(err.messages))
password = None password = None
except KeyboardInterrupt: except KeyboardInterrupt:
......
...@@ -160,7 +160,7 @@ class ChangepasswordManagementCommandTestCase(TestCase): ...@@ -160,7 +160,7 @@ class ChangepasswordManagementCommandTestCase(TestCase):
abort_msg = "Aborting password change for user 'joe' after 3 attempts" abort_msg = "Aborting password change for user 'joe' after 3 attempts"
with self.assertRaisesMessage(CommandError, abort_msg): with self.assertRaisesMessage(CommandError, abort_msg):
command.execute(username="joe", stdout=self.stdout, stderr=self.stderr) command.execute(username="joe", stdout=self.stdout, stderr=self.stderr)
self.assertIn('This password is entirely numeric.', self.stdout.getvalue()) self.assertIn('This password is entirely numeric.', self.stderr.getvalue())
def test_that_changepassword_command_works_with_nonascii_output(self): def test_that_changepassword_command_works_with_nonascii_output(self):
""" """
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment