Commit 365c3e8b authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Replaced "not PY3" by "PY2", new in six 1.4.0.

parent 42920970
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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:
+2 −2
Original line number Diff line number Diff line
@@ -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)
@@ -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']
+1 −1
Original line number Diff line number Diff line
@@ -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',
+1 −1
Original line number Diff line number Diff line
@@ -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']:
+3 −3
Original line number Diff line number Diff line
@@ -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