summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-06-15 09:43:35 -0400
committerTim Graham <timograham@gmail.com>2015-06-18 08:36:50 -0400
commit7f1168e387dc1db70b6093cfd23a4a6978f48109 (patch)
treec3a9f335536fa078d39ad43458feaeac990e3538 /django
parente5cb4e14118f3a508e3bc00ee7cd50bb0f18a61d (diff)
Removed support for Python 3.3.
Diffstat (limited to 'django')
-rw-r--r--django/apps/config.py2
-rw-r--r--django/core/mail/message.py9
-rw-r--r--django/db/backends/sqlite3/features.py5
-rw-r--r--django/dispatch/dispatcher.py5
-rw-r--r--django/utils/functional.py2
-rw-r--r--django/utils/glob.py33
-rw-r--r--django/utils/html_parser.py3
-rw-r--r--django/utils/module_loading.py7
8 files changed, 21 insertions, 45 deletions
diff --git a/django/apps/config.py b/django/apps/config.py
index 76b3014d9d..98070e62c8 100644
--- a/django/apps/config.py
+++ b/django/apps/config.py
@@ -55,7 +55,7 @@ class AppConfig(object):
"""Attempt to determine app's filesystem path from its module."""
# See #21874 for extended discussion of the behavior of this method in
# various cases.
- # Convert paths to list because Python 3.3 _NamespacePath does not
+ # Convert paths to list because Python 3's _NamespacePath does not
# support indexing.
paths = list(getattr(module, '__path__', []))
if len(paths) != 1:
diff --git a/django/core/mail/message.py b/django/core/mail/message.py
index 70a7fda1d4..e8d209c9da 100644
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
import mimetypes
import os
import random
-import sys
import time
from email import (
charset as Charset, encoders as Encoders, generator, message_from_string,
@@ -170,13 +169,7 @@ class SafeMIMEText(MIMEMixin, MIMEText):
# We do it manually and trigger re-encoding of the payload.
MIMEText.__init__(self, _text, _subtype, None)
del self['Content-Transfer-Encoding']
- # Workaround for versions without http://bugs.python.org/issue19063
- if (3, 2) < sys.version_info < (3, 3, 4):
- payload = _text.encode(utf8_charset.output_charset)
- self._payload = payload.decode('ascii', 'surrogateescape')
- self.set_charset(utf8_charset)
- else:
- self.set_payload(_text, utf8_charset)
+ self.set_payload(_text, utf8_charset)
self.replace_header('Content-Type', 'text/%s; charset="%s"' % (_subtype, _charset))
elif _charset is None:
# the default value of '_charset' is 'us-ascii' on Python 2
diff --git a/django/db/backends/sqlite3/features.py b/django/db/backends/sqlite3/features.py
index ee86469177..5697b8b7eb 100644
--- a/django/db/backends/sqlite3/features.py
+++ b/django/db/backends/sqlite3/features.py
@@ -1,9 +1,8 @@
from __future__ import unicode_literals
-import sys
-
from django.db import utils
from django.db.backends.base.features import BaseDatabaseFeatures
+from django.utils import six
from django.utils.functional import cached_property
from .base import Database
@@ -50,7 +49,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
@cached_property
def can_share_in_memory_db(self):
return (
- sys.version_info[:2] >= (3, 4) and
+ six.PY3 and
Database.__name__ == 'sqlite3.dbapi2' and
Database.sqlite_version_info >= (3, 7, 13)
)
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index b2d774bda6..73213afe94 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -3,11 +3,12 @@ import threading
import warnings
import weakref
+from django.utils import six
from django.utils.deprecation import RemovedInDjango21Warning
from django.utils.inspect import func_accepts_kwargs
from django.utils.six.moves import range
-if sys.version_info < (3, 4):
+if six.PY2:
from .weakref_backports import WeakMethod
else:
from weakref import WeakMethod
@@ -108,7 +109,7 @@ class Signal(object):
if hasattr(receiver, '__self__') and hasattr(receiver, '__func__'):
ref = WeakMethod
receiver_object = receiver.__self__
- if sys.version_info >= (3, 4):
+ if six.PY3:
receiver = ref(receiver)
weakref.finalize(receiver_object, self._remove_receiver)
else:
diff --git a/django/utils/functional.py b/django/utils/functional.py
index bade67de46..c0d19093fc 100644
--- a/django/utils/functional.py
+++ b/django/utils/functional.py
@@ -251,7 +251,7 @@ class LazyObject(object):
self._setup()
return self._wrapped.__dict__
- # Python 3.3 will call __reduce__ when pickling; this method is needed
+ # Python 3 will call __reduce__ when pickling; this method is needed
# to serialize and deserialize correctly.
@classmethod
def __newobj__(cls, *args):
diff --git a/django/utils/glob.py b/django/utils/glob.py
index a3138b09dc..d3f9e08138 100644
--- a/django/utils/glob.py
+++ b/django/utils/glob.py
@@ -7,30 +7,15 @@ from django.utils import six
# backport of Python 3.4's glob.escape
-try:
+if six.PY3:
from glob import escape as glob_escape
-except ImportError:
+else:
_magic_check = re.compile('([*?[])')
- if six.PY3:
- _magic_check_bytes = re.compile(b'([*?[])')
-
- def glob_escape(pathname):
- """
- Escape all special characters.
- """
- drive, pathname = os.path.splitdrive(pathname)
- if isinstance(pathname, bytes):
- pathname = _magic_check_bytes.sub(br'[\1]', pathname)
- else:
- pathname = _magic_check.sub(r'[\1]', pathname)
- return drive + pathname
-
- else:
- def glob_escape(pathname):
- """
- Escape all special characters.
- """
- drive, pathname = os.path.splitdrive(pathname)
- pathname = _magic_check.sub(r'[\1]', pathname)
- return drive + pathname
+ def glob_escape(pathname):
+ """
+ Escape all special characters.
+ """
+ drive, pathname = os.path.splitdrive(pathname)
+ pathname = _magic_check.sub(r'[\1]', pathname)
+ return drive + pathname
diff --git a/django/utils/html_parser.py b/django/utils/html_parser.py
index e7f7c11571..a69f914921 100644
--- a/django/utils/html_parser.py
+++ b/django/utils/html_parser.py
@@ -1,6 +1,7 @@
import re
import sys
+from django.utils import six
from django.utils.six.moves import html_parser as _html_parser
current_version = sys.version_info
@@ -15,7 +16,7 @@ except AttributeError:
pass
if not use_workaround:
- if current_version >= (3, 4):
+ if six.PY3:
class HTMLParser(_html_parser.HTMLParser):
"""Explicitly set convert_charrefs to be False.
diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py
index c42d208178..4a2c500321 100644
--- a/django/utils/module_loading.py
+++ b/django/utils/module_loading.py
@@ -63,11 +63,8 @@ def autodiscover_modules(*args, **kwargs):
raise
-if sys.version_info[:2] >= (3, 3):
- if sys.version_info[:2] >= (3, 4):
- from importlib.util import find_spec as importlib_find
- else:
- from importlib import find_loader as importlib_find
+if six.PY3:
+ from importlib.util import find_spec as importlib_find
def module_has_submodule(package, module_name):
"""See if 'module' is in 'package'."""