Ticket #20364: 20364.diff

File 20364.diff, 1.3 KB (added by Chris Piwoński <piwonski.kris@…>, 2 years ago)

ticket patch

  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index 650e848..27e6e0c 100644
    a b from django.utils import six 
    1717from django.utils.text import normalize_newlines
    1818
    1919# Configuration for urlize() function.
    20 TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
    21 WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;')]
     20TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)', '"', '\'']
     21WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;'), ('"', '"'), ('\'', '\'')]
    2222
    2323# List of possible strings used for bullets in bulleted lists.
    2424DOTS = ['&middot;', '*', '\u2022', '&#149;', '&bull;', '&#8226;']
  • tests/utils_tests/test_html.py

    diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
    index 090cc32..74c3c42 100644
    a b class TestUtilsHtml(TestCase): 
    174174        )
    175175        for value, tags, output in items:
    176176            self.assertEqual(f(value, tags), output)
     177
     178    def test_urlize(self):
     179        f = html.urlize
     180        items = (
     181            ("before \"hi@example.com\" afterwards", u'before "<a href="mailto:hi@example.com">hi@example.com</a>" afterwards'),
     182        )
     183        for value, output in items:
     184            self.assertEqual(f(value), output)
Back to Top