Commit fed25f11 authored by Tim Graham's avatar Tim Graham
Browse files

Removed compatibility with Python 3.2.

parent 4e65f195
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -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()
    try:
        addr.encode('ascii')
    except UnicodeEncodeError:  # IDN
+0 −2
Original line number Diff line number Diff line
@@ -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('_')]

+2 −10
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
from __future__ import unicode_literals

import re
import sys
import warnings

from django.utils.deprecation import RemovedInDjango20Warning
@@ -135,11 +134,6 @@ 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)
        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()
+1 −4
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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.

Loading