Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fixed #18644 -- Made urlize trim trailing period followed by parenthesis #216

merged 1 commit into from

3 participants


Added '.)' to TRAILING_PUNCTUATION so that a period will be stripped from URLs also when it is followed by a close parenthesis. See Ticket #18644.


urlize is already extensively tested in regressionttests/defaultfilters/ Please move your test there.


@claudep Thanks for showing me where the test should go. Moved it and amended the existing commit.

@apollo13 apollo13 merged commit 59d9977 into django:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  django/utils/
@@ -13,7 +13,7 @@
from django.utils.text import normalize_newlines
# Configuration for urlize() function.
-TRAILING_PUNCTUATION = ['.', ',', ':', ';']
+TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('&lt;', '&gt;')]
# List of possible strings used for bullets in bulleted lists.
4 tests/regressiontests/defaultfilters/
@@ -297,6 +297,10 @@ def test_urlize(self):
'<a href="" rel="nofollow">HTTPS://</a>')
+ # Check urlize trims trailing period when followed by parenthesis - see #18644
+ self.assertEqual(urlize('(Go to'),
+ '(Go to <a href="" rel="nofollow"></a>.)')
def test_wordcount(self):
self.assertEqual(wordcount(''), 0)
self.assertEqual(wordcount('oneword'), 1)
Something went wrong with that request. Please try again.