Ticket #27857: 27857.diff

File 27857.diff, 10.4 KB (added by Tim Graham, 8 years ago)
  • INSTALL

    diff --git a/INSTALL b/INSTALL
    index be64877..dda9b4c 100644
    a b  
    11Thanks for downloading Django.
    22
    3 To install it, make sure you have Python 3.4 or greater installed. Then run
     3To install it, make sure you have Python 3.5 or greater installed. Then run
    44this command from the command prompt:
    55
    66    python setup.py install
  • django/http/cookie.py

    diff --git a/django/http/cookie.py b/django/http/cookie.py
    index 52dff78..5c3fb94 100644
    a b  
    1 import sys
    21from http import cookies
    32
    4 # Cookie pickling bug is fixed in Python 3.4.3+
    5 # http://bugs.python.org/issue22775
    6 if sys.version_info >= (3, 4, 3):
    7     SimpleCookie = cookies.SimpleCookie
    8 else:
    9     Morsel = cookies.Morsel
    10 
    11     class SimpleCookie(cookies.SimpleCookie):
    12         def __setitem__(self, key, value):
    13             if isinstance(value, Morsel):
    14                 # allow assignment of constructed Morsels (e.g. for pickling)
    15                 dict.__setitem__(self, key, value)
    16             else:
    17                 super().__setitem__(key, value)
     3# For backwards compatibility in Django 2.X.
     4SimpleCookie = cookies.SimpleCookie
    185
    196
    207def parse_cookie(cookie):
  • django/test/html.py

    diff --git a/django/test/html.py b/django/test/html.py
    index 900aa3d..d2e6efe 100644
    a b Comparing two html documents.  
    33"""
    44
    55import re
    6 
    7 from django.utils.html_parser import HTMLParseError, HTMLParser
     6from html.parser import HTMLParser
    87
    98WHITESPACE = re.compile(r'\s+')
    109
    class RootElement(Element):  
    140139        return ''.join(str(c) for c in self.children)
    141140
    142141
     142class HTMLParseError(Exception):
     143    pass
     144
     145
    143146class Parser(HTMLParser):
    144147    SELF_CLOSING_TAGS = (
    145148        'br', 'hr', 'input', 'img', 'meta', 'spacer', 'link', 'frame', 'base',
    class Parser(HTMLParser):  
    147150    )
    148151
    149152    def __init__(self):
    150         HTMLParser.__init__(self)
     153        HTMLParser.__init__(self, convert_charrefs=False)
    151154        self.root = RootElement()
    152155        self.open_tags = []
    153156        self.element_positions = {}
  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index 18c650f..fb847a8 100644
    a b  
    11"""HTML utilities suitable for global use."""
    22
    33import re
     4from html.parser import HTMLParser
    45from urllib.parse import (
    56    parse_qsl, quote, unquote, urlencode, urlsplit, urlunsplit,
    67)
    from django.utils.http import RFC3986_GENDELIMS, RFC3986_SUBDELIMS  
    1112from django.utils.safestring import SafeData, SafeText, mark_safe
    1213from django.utils.text import normalize_newlines
    1314
    14 from .html_parser import HTMLParseError, HTMLParser
    15 
    1615# Configuration for urlize() function.
    1716TRAILING_PUNCTUATION_RE = re.compile(
    1817    '^'           # Beginning of word
    def linebreaks(value, autoescape=False):  
    131130
    132131class MLStripper(HTMLParser):
    133132    def __init__(self):
    134         HTMLParser.__init__(self)
     133        HTMLParser.__init__(self, convert_charrefs=False)
    135134        self.reset()
    136135        self.fed = []
    137136
    def _strip_once(value):  
    153152    Internal tag stripping utility used by strip_tags.
    154153    """
    155154    s = MLStripper()
    156     try:
    157         s.feed(value)
    158     except HTMLParseError:
    159         return value
    160     try:
    161         s.close()
    162     except HTMLParseError:
    163         return s.get_data() + s.rawdata
    164     else:
    165         return s.get_data()
     155    s.feed(value)
     156    s.close()
     157    return s.get_data()
    166158
    167159
    168160@keep_lazy_text
  • deleted file django/utils/html_parser.py

    diff --git a/django/utils/html_parser.py b/django/utils/html_parser.py
    deleted file mode 100644
    index 6b46ddc..0000000
    + -  
    1 import html.parser
    2 
    3 try:
    4     HTMLParseError = html.parser.HTMLParseError
    5 except AttributeError:
    6     # create a dummy class for Python 3.5+ where it's been removed
    7     class HTMLParseError(Exception):
    8         pass
    9 
    10 
    11 class HTMLParser(html.parser.HTMLParser):
    12     """Explicitly set convert_charrefs to be False.
    13 
    14     This silences a deprecation warning on Python 3.4.
    15     """
    16     def __init__(self, convert_charrefs=False, **kwargs):
    17         html.parser.HTMLParser.__init__(self, convert_charrefs=convert_charrefs, **kwargs)
  • docs/intro/install.txt

    diff --git a/docs/intro/install.txt b/docs/intro/install.txt
    index 7a338ee..eda052c 100644
    a b your operating system's package manager.  
    2929You can verify that Python is installed by typing ``python`` from your shell;
    3030you should see something like::
    3131
    32     Python 3.4.x
     32    Python 3.x.y
    3333    [GCC 4.x] on linux
    3434    Type "help", "copyright", "credits" or "license" for more information.
    3535    >>>
  • docs/intro/tutorial01.txt

    diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
    index 05ee9c3..cbb5b73 100644
    a b in a shell prompt (indicated by the $ prefix):  
    2323If Django is installed, you should see the version of your installation. If it
    2424isn't, you'll get an error telling "No module named django".
    2525
    26 This tutorial is written for Django |version| and Python 3.4 or later. If the
     26This tutorial is written for Django |version| and Python 3.5 or later. If the
    2727Django version doesn't match, you can refer to the tutorial for your version
    2828of Django by using the version switcher at the bottom right corner of this
    2929page, or update Django to the newest version. If you are still using Python
  • docs/ref/applications.txt

    diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt
    index be3f554..9fd2a41 100644
    a b Configurable attributes  
    192192.. attribute:: AppConfig.path
    193193
    194194    Filesystem path to the application directory, e.g.
    195     ``'/usr/lib/python3.4/dist-packages/django/contrib/admin'``.
     195    ``'/usr/lib/pythonX.Y/dist-packages/django/contrib/admin'``.
    196196
    197197    In most cases, Django can automatically detect and set this, but you can
    198198    also provide an explicit override as a class attribute on your
  • setup.py

    diff --git a/setup.py b/setup.py
    index e9cfa4f..a936760 100644
    a b setup(  
    6262        'Operating System :: OS Independent',
    6363        'Programming Language :: Python',
    6464        'Programming Language :: Python :: 3',
    65         'Programming Language :: Python :: 3.4',
    6665        'Programming Language :: Python :: 3.5',
    6766        'Programming Language :: Python :: 3.6',
    6867        'Topic :: Internet :: WWW/HTTP',
  • tests/mail/tests.py

    diff --git a/tests/mail/tests.py b/tests/mail/tests.py
    index 63737b3..ade8993 100644
    a b class FakeSMTPServer(smtpd.SMTPServer, threading.Thread):  
    11381138    def __init__(self, *args, **kwargs):
    11391139        threading.Thread.__init__(self)
    11401140        # New kwarg added in Python 3.5; default switching to False in 3.6.
    1141         if sys.version_info >= (3, 5):
    1142             kwargs['decode_data'] = True
     1141        # Setting a value only silences a deprecation warning in PY35.
     1142        kwargs['decode_data'] = True
    11431143        smtpd.SMTPServer.__init__(self, *args, **kwargs)
    11441144        self._sink = []
    11451145        self.active = False
  • tests/sessions_tests/tests.py

    diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py
    index 9654c7d..de7e41f 100644
    a b import base64  
    22import os
    33import shutil
    44import string
    5 import sys
    65import tempfile
    76import unittest
    87from datetime import timedelta
    class SessionMiddlewareTests(TestCase):  
    726725        # A deleted cookie header looks like:
    727726        #  Set-Cookie: sessionid=; expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/
    728727        self.assertEqual(
    729             'Set-Cookie: {}={}; expires=Thu, 01-Jan-1970 00:00:00 GMT; '
     728            'Set-Cookie: {}=""; expires=Thu, 01-Jan-1970 00:00:00 GMT; '
    730729            'Max-Age=0; Path=/'.format(
    731730                settings.SESSION_COOKIE_NAME,
    732                 '""' if sys.version_info >= (3, 5) else '',
    733731            ),
    734732            str(response.cookies[settings.SESSION_COOKIE_NAME])
    735733        )
    class SessionMiddlewareTests(TestCase):  
    756754        #              expires=Thu, 01-Jan-1970 00:00:00 GMT; Max-Age=0;
    757755        #              Path=/example/
    758756        self.assertEqual(
    759             'Set-Cookie: {}={}; Domain=.example.local; expires=Thu, '
     757            'Set-Cookie: {}=""; Domain=.example.local; expires=Thu, '
    760758            '01-Jan-1970 00:00:00 GMT; Max-Age=0; Path=/example/'.format(
    761759                settings.SESSION_COOKIE_NAME,
    762                 '""' if sys.version_info >= (3, 5) else '',
    763760            ),
    764761            str(response.cookies[settings.SESSION_COOKIE_NAME])
    765762        )
  • tests/test_runner/test_debug_sql.py

    diff --git a/tests/test_runner/test_debug_sql.py b/tests/test_runner/test_debug_sql.py
    index 1b36fbc..c73b260 100644
    a b  
    1 import sys
    21import unittest
    32from io import StringIO
    43
    class TestDebugSQL(unittest.TestCase):  
    6867    ]
    6968
    7069    verbose_expected_outputs = [
    71         # Output format changed in Python 3.5+
    72         x.format('' if sys.version_info < (3, 5) else 'TestDebugSQL.') for x in [
    73             'runTest (test_runner.test_debug_sql.{}FailingTest) ... FAIL',
    74             'runTest (test_runner.test_debug_sql.{}ErrorTest) ... ERROR',
    75             'runTest (test_runner.test_debug_sql.{}PassingTest) ... ok',
    76         ]
     70        'runTest (test_runner.test_debug_sql.TestDebugSQL.FailingTest) ... FAIL',
     71        'runTest (test_runner.test_debug_sql.TestDebugSQL.ErrorTest) ... ERROR',
     72        'runTest (test_runner.test_debug_sql.TestDebugSQL.PassingTest) ... ok',
    7773    ] + [
    7874        ('''SELECT COUNT(*) AS "__count" '''
    7975            '''FROM "test_runner_person" WHERE '''
  • tests/test_utils/tests.py

    diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
    index 19ef405..baedf05 100644
    a b  
    11import os
    2 import sys
    32import unittest
    43from io import StringIO
    54
    class HTMLEqualTests(SimpleTestCase):  
    646645        error_msg = (
    647646            "First argument is not valid HTML:\n"
    648647            "('Unexpected end tag `div` (Line 1, Column 6)', (1, 6))"
    649         ) if sys.version_info >= (3, 5) else (
    650             "First argument is not valid HTML:\n"
    651             "Unexpected end tag `div` (Line 1, Column 6), at line 1, column 7"
    652648        )
    653649        with self.assertRaisesMessage(AssertionError, error_msg):
    654650            self.assertHTMLEqual('< div></ div>', '<div></div>')
Back to Top