Ticket #19070: 19070-1.diff

File 19070-1.diff, 1.6 KB (added by claudep, 3 years ago)

Fixing the square bracket issue

  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index cc83729..9816b9a 100644
    a b from django.utils.text import normalize_newlines 
    1818
    1919# Configuration for urlize() function.
    2020TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
    21 WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('&lt;', '&gt;')]
     21WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;')]
    2222
    2323# List of possible strings used for bullets in bulleted lists.
    2424DOTS = ['&middot;', '*', '\u2022', '&#149;', '&bull;', '&#8226;']
  • tests/regressiontests/defaultfilters/tests.py

    diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py
    index bdf3c86..8e800ef 100644
    a b class DefaultFiltersTests(TestCase): 
    301301
    302302        # Check urlize trims trailing period when followed by parenthesis - see #18644
    303303        self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
    304                          '(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
     304            '(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
     305
     306        # Check urlize doesn't crash when square bracket is appended to url (#19070)
     307        self.assertEqual(urlize('[see www.example.com]'),
     308            '[see <a href="http://www.example.com" rel="nofollow">www.example.com</a>]' )
     309
    305310
    306311    def test_wordcount(self):
    307312        self.assertEqual(wordcount(''), 0)
Back to Top