summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-11-24 08:34:02 -0500
committerTim Graham <timograham@gmail.com>2015-01-17 09:00:17 -0500
commitfed25f1105ff0d5fe46cd217b29371ee7f1907f2 (patch)
tree7b5320882f1034a65047948c30d56f38b28a5ba3
parent4e65f195e1b10d83bb7edc38c908747c4fd537b8 (diff)
Removed compatibility with Python 3.2.
-rw-r--r--django/core/mail/message.py7
-rw-r--r--django/core/management/__init__.py2
-rw-r--r--django/utils/html.py12
-rw-r--r--django/utils/html_parser.py5
-rw-r--r--docs/faq/install.txt2
-rw-r--r--docs/intro/install.txt6
-rw-r--r--docs/intro/tutorial01.txt2
-rw-r--r--docs/topics/install.txt4
-rw-r--r--setup.py1
-rw-r--r--tests/requirements/base.txt2
-rw-r--r--tests/requirements/py2.txt1
-rw-r--r--tests/template_backends/test_jinja2.py17
12 files changed, 17 insertions, 44 deletions
diff --git a/django/core/mail/message.py b/django/core/mail/message.py
index 8d2dc0b72d..b895cd6f78 100644
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -104,12 +104,7 @@ def sanitize_address(addr, encoding):
if isinstance(addr, six.string_types):
addr = parseaddr(force_text(addr))
nm, addr = addr
- # This try-except clause is needed on Python 3 < 3.2.4
- # http://bugs.python.org/issue14291
- try:
- nm = Header(nm, encoding).encode()
- except UnicodeEncodeError:
- nm = Header(nm, 'utf-8').encode()
+ nm = Header(nm, encoding).encode()
try:
addr.encode('ascii')
except UnicodeEncodeError: # IDN
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index f7504794e3..0254dcbefe 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -25,8 +25,6 @@ def find_commands(management_dir):
Returns an empty list if no commands are defined.
"""
command_dir = os.path.join(management_dir, 'commands')
- # Workaround for a Python 3.2 bug with pkgutil.iter_modules
- sys.path_importer_cache.pop(command_dir, None)
return [name for _, name, is_pkg in pkgutil.iter_modules([command_dir])
if not is_pkg and not name.startswith('_')]
diff --git a/django/utils/html.py b/django/utils/html.py
index a596662d22..758d458f40 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -3,7 +3,6 @@
from __future__ import unicode_literals
import re
-import sys
import warnings
from django.utils.deprecation import RemovedInDjango20Warning
@@ -135,12 +134,7 @@ linebreaks = allow_lazy(linebreaks, six.text_type)
class MLStripper(HTMLParser):
def __init__(self):
- # The strict parameter was added in Python 3.2 with a default of True.
- # The default changed to False in Python 3.3 and was deprecated.
- if sys.version_info[:2] == (3, 2):
- HTMLParser.__init__(self, strict=False)
- else:
- HTMLParser.__init__(self)
+ HTMLParser.__init__(self)
self.reset()
self.fed = []
@@ -168,9 +162,7 @@ def _strip_once(value):
return value
try:
s.close()
- except (HTMLParseError, UnboundLocalError):
- # UnboundLocalError because of http://bugs.python.org/issue17802
- # on Python 3.2, triggered by strict=False mode of HTMLParser
+ except HTMLParseError:
return s.get_data() + s.rawdata
else:
return s.get_data()
diff --git a/django/utils/html_parser.py b/django/utils/html_parser.py
index ab1f654978..4aff4a9a78 100644
--- a/django/utils/html_parser.py
+++ b/django/utils/html_parser.py
@@ -4,10 +4,7 @@ import sys
current_version = sys.version_info
-use_workaround = (
- (current_version < (2, 7, 3)) or
- (current_version >= (3, 0) and current_version < (3, 2, 3))
-)
+use_workaround = current_version < (2, 7, 3)
try:
HTMLParseError = _html_parser.HTMLParseError
diff --git a/docs/faq/install.txt b/docs/faq/install.txt
index 14e7d8b995..a2520d71dd 100644
--- a/docs/faq/install.txt
+++ b/docs/faq/install.txt
@@ -16,7 +16,7 @@ How do I get started?
What are Django's prerequisites?
--------------------------------
-Django requires Python, specifically Python 2.7 or 3.2 and above. Other Python
+Django requires Python, specifically Python 2.7 or 3.3 and above. Other Python
libraries may be required for some uses, but you'll receive an error about it
as they're needed.
diff --git a/docs/intro/install.txt b/docs/intro/install.txt
index 64e07f1d76..410cb8f032 100644
--- a/docs/intro/install.txt
+++ b/docs/intro/install.txt
@@ -9,9 +9,9 @@ that'll work while you walk through the introduction.
Install Python
--------------
-Being a Python Web framework, Django requires Python. It works with Python 2.7,
-3.2, 3.3, or 3.4. All these versions of Python include a lightweight database
-called SQLite_ so you won't need to set up a database just yet.
+Being a Python Web framework, Django requires Python. It works with Python 2.7
+3.3+. All these versions of Python include a lightweight database called
+SQLite_ so you won't need to set up a database just yet.
.. _sqlite: http://sqlite.org/
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index 8c9c4a30e7..dc34e8765c 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -22,7 +22,7 @@ tell Django is installed and which version by running the following command:
If Django is installed, you should see the version of your installation. If it
isn't, you'll get an error telling "No module named django".
-This tutorial is written for Django |version| and Python 3.2 or later. If the
+This tutorial is written for Django |version| and Python 3.3 or later. If the
Django version doesn't match, you can refer to the tutorial for your version
of Django by using the version switcher at the bottom right corner of this
page, or update Django to the newest version. If you are still using Python
diff --git a/docs/topics/install.txt b/docs/topics/install.txt
index 65e55ddbe6..103152bc3e 100644
--- a/docs/topics/install.txt
+++ b/docs/topics/install.txt
@@ -7,8 +7,8 @@ This document will get you up and running with Django.
Install Python
==============
-Being a Python Web framework, Django requires Python. It works with Python 2.7,
-3.2 or 3.3.
+Being a Python Web framework, Django requires Python. It works with Python 2.7
+or 3.3+.
Get the latest version of Python at https://www.python.org/download/ or with
your operating system's package manager.
diff --git a/setup.py b/setup.py
index 83fd792ffa..afe299abd8 100644
--- a/setup.py
+++ b/setup.py
@@ -62,7 +62,6 @@ setup(
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP',
diff --git a/tests/requirements/base.txt b/tests/requirements/base.txt
index 3ffb042ae9..f74ffe1274 100644
--- a/tests/requirements/base.txt
+++ b/tests/requirements/base.txt
@@ -1,8 +1,6 @@
bcrypt
docutils
jinja2
-# move to py2.txt when dropping Python 3.2
-mock
numpy
Pillow
PyYAML
diff --git a/tests/requirements/py2.txt b/tests/requirements/py2.txt
index a9f6804039..abce38c39c 100644
--- a/tests/requirements/py2.txt
+++ b/tests/requirements/py2.txt
@@ -1,2 +1,3 @@
-r base.txt
python-memcached
+mock
diff --git a/tests/template_backends/test_jinja2.py b/tests/template_backends/test_jinja2.py
index f8cbc047c1..1442f25e02 100644
--- a/tests/template_backends/test_jinja2.py
+++ b/tests/template_backends/test_jinja2.py
@@ -2,22 +2,15 @@
# silence an ImportWarning warning on Python 2.
from __future__ import absolute_import
-import sys
-
from unittest import skipIf
-# Jinja2 doesn't run on Python 3.2 because it uses u-prefixed unicode strings.
-if sys.version_info[:2] == (2, 7) or sys.version_info[:2] >= (3, 3):
- try:
- import jinja2
- except ImportError:
- jinja2 = None
- Jinja2 = None
- else:
- from django.template.backends.jinja2 import Jinja2
-else:
+try:
+ import jinja2
+except ImportError:
jinja2 = None
Jinja2 = None
+else:
+ from django.template.backends.jinja2 import Jinja2
from .test_dummy import TemplateStringsTests