Ticket #18160: auth_unknown_encoding.diff
File auth_unknown_encoding.diff, 1.3 KB (added by , 13 years ago) |
---|
-
django/contrib/auth/tests/management.py
29 29 management.get_system_username = lambda: u'J\xfalia' 30 30 self.assertEqual(management.get_default_username(), 'julia') 31 31 32 def test_unknown_encoding(self): 33 import locale 34 locale.getdefaultlocale = lambda: ("en_US", "x-mac-simp-chinese") 35 self.assertEqual(management.get_default_username(), '') 32 36 37 33 38 class ChangepasswordManagementCommandTestCase(TestCase): 34 39 35 40 def setUp(self): -
django/contrib/auth/management/__init__.py
83 83 """ 84 84 try: 85 85 return getpass.getuser().decode(locale.getdefaultlocale()[1]) 86 except (ImportError, KeyError, UnicodeDecodeError):86 except (ImportError, KeyError, LookupError, UnicodeDecodeError): 87 87 # KeyError will be raised by os.getpwuid() (called by getuser()) 88 88 # if there is no corresponding entry in the /etc/passwd file 89 89 # (a very restricted chroot environment, for example).