Loading django/contrib/auth/management/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ def get_system_username(): # if there is no corresponding entry in the /etc/passwd file # (a very restricted chroot environment, for example). return '' if not six.PY3: if six.PY2: try: result = result.decode(DEFAULT_LOCALE_ENCODING) except UnicodeDecodeError: Loading django/contrib/auth/tests/test_basic.py +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from django.test.signals import setting_changed from django.test.utils import override_settings from django.utils import translation from django.utils.encoding import force_str from django.utils.six import binary_type, PY3, StringIO from django.utils.six import binary_type, PY2, StringIO @receiver(setting_changed) Loading @@ -39,7 +39,7 @@ def mock_inputs(inputs): class mock_getpass: @staticmethod def getpass(prompt=b'Password: ', stream=None): if not PY3: if PY2: # getpass on Windows only supports prompt as bytestring (#19807) assert isinstance(prompt, binary_type) return inputs['password'] Loading django/core/mail/message.py +1 −1 Original line number Diff line number Diff line Loading @@ -366,7 +366,7 @@ class EmailMessage(object): try: filename.encode('ascii') except UnicodeEncodeError: if not six.PY3: if six.PY2: filename = filename.encode('utf-8') filename = ('utf-8', '', filename) attachment.add_header('Content-Disposition', 'attachment', Loading django/db/backends/mysql/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -420,7 +420,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): 'conv': django_conversions, 'charset': 'utf8', } if not six.PY3: if six.PY2: kwargs['use_unicode'] = True settings_dict = self.settings_dict if settings_dict['USER']: Loading django/db/backends/oracle/base.py +3 −3 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ WHEN (new.%(col_name)s IS NULL) # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement # The DB API definition does not define this attribute. statement = cursor.statement if statement and not six.PY3 and not isinstance(statement, unicode): if statement and six.PY2 and not isinstance(statement, unicode): statement = statement.decode('utf-8') # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's # `statement` doesn't contain the query parameters. refs #20010. Loading Loading
django/contrib/auth/management/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,7 @@ def get_system_username(): # if there is no corresponding entry in the /etc/passwd file # (a very restricted chroot environment, for example). return '' if not six.PY3: if six.PY2: try: result = result.decode(DEFAULT_LOCALE_ENCODING) except UnicodeDecodeError: Loading
django/contrib/auth/tests/test_basic.py +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ from django.test.signals import setting_changed from django.test.utils import override_settings from django.utils import translation from django.utils.encoding import force_str from django.utils.six import binary_type, PY3, StringIO from django.utils.six import binary_type, PY2, StringIO @receiver(setting_changed) Loading @@ -39,7 +39,7 @@ def mock_inputs(inputs): class mock_getpass: @staticmethod def getpass(prompt=b'Password: ', stream=None): if not PY3: if PY2: # getpass on Windows only supports prompt as bytestring (#19807) assert isinstance(prompt, binary_type) return inputs['password'] Loading
django/core/mail/message.py +1 −1 Original line number Diff line number Diff line Loading @@ -366,7 +366,7 @@ class EmailMessage(object): try: filename.encode('ascii') except UnicodeEncodeError: if not six.PY3: if six.PY2: filename = filename.encode('utf-8') filename = ('utf-8', '', filename) attachment.add_header('Content-Disposition', 'attachment', Loading
django/db/backends/mysql/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -420,7 +420,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): 'conv': django_conversions, 'charset': 'utf8', } if not six.PY3: if six.PY2: kwargs['use_unicode'] = True settings_dict = self.settings_dict if settings_dict['USER']: Loading
django/db/backends/oracle/base.py +3 −3 Original line number Diff line number Diff line Loading @@ -276,7 +276,7 @@ WHEN (new.%(col_name)s IS NULL) # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement # The DB API definition does not define this attribute. statement = cursor.statement if statement and not six.PY3 and not isinstance(statement, unicode): if statement and six.PY2 and not isinstance(statement, unicode): statement = statement.decode('utf-8') # Unlike Psycopg's `query` and MySQLdb`'s `_last_executed`, CxOracle's # `statement` doesn't contain the query parameters. refs #20010. Loading