From d5012d6371e804fc0427112cc1ceacbe8a059c4f Mon Sep 17 00:00:00 2001 From: Vebjorn Ljosa Date: Tue, 17 Jul 2012 10:38:04 -0400 Subject: [PATCH] Fixed #18644 -- Made urlize trim trailing period followed by parenthesis --- django/utils/html.py | 2 +- tests/regressiontests/defaultfilters/tests.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/django/utils/html.py b/django/utils/html.py index 390c45dcec..6a47bfc869 100644 --- a/django/utils/html.py +++ b/django/utils/html.py @@ -13,7 +13,7 @@ from django.utils.functional import allow_lazy from django.utils.text import normalize_newlines # Configuration for urlize() function. -TRAILING_PUNCTUATION = ['.', ',', ':', ';'] +TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)'] WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('<', '>')] # List of possible strings used for bullets in bulleted lists. diff --git a/tests/regressiontests/defaultfilters/tests.py b/tests/regressiontests/defaultfilters/tests.py index ffa0a01132..d08bcf0fd9 100644 --- a/tests/regressiontests/defaultfilters/tests.py +++ b/tests/regressiontests/defaultfilters/tests.py @@ -297,6 +297,10 @@ class DefaultFiltersTests(TestCase): self.assertEqual(urlize('HTTPS://github.com/'), 'HTTPS://github.com/') + # Check urlize trims trailing period when followed by parenthesis - see #18644 + self.assertEqual(urlize('(Go to http://www.example.com/foo.)'), + '(Go to http://www.example.com/foo.)') + def test_wordcount(self): self.assertEqual(wordcount(''), 0) self.assertEqual(wordcount('oneword'), 1)