Code

Ticket #16017: check_for_type_error.diff

File check_for_type_error.diff, 697 bytes (added by tbecker, 22 months ago)

Just check for TypeError and be done with it

Line 
1diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py
2index 100acb6..54b60d7 100644
3--- a/django/contrib/auth/management/__init__.py
4+++ b/django/contrib/auth/management/__init__.py
5@@ -85,7 +85,7 @@ def get_system_username():
6     """
7     try:
8         return getpass.getuser().decode(locale.getdefaultlocale()[1])
9-    except (ImportError, KeyError, UnicodeDecodeError):
10+    except (TypeError, ImportError, KeyError, UnicodeDecodeError):
11         # KeyError will be raised by os.getpwuid() (called by getuser())
12         # if there is no corresponding entry in the /etc/passwd file
13         # (a very restricted chroot environment, for example).