Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit d5012d6371e804fc0427112cc1ceacbe8a059c4f 1 parent 29132eb
Vebjorn Ljosa authored July 17, 2012
2  django/utils/html.py
@@ -13,7 +13,7 @@
13 13
 from django.utils.text import normalize_newlines
14 14
 
15 15
 # Configuration for urlize() function.
16  
-TRAILING_PUNCTUATION = ['.', ',', ':', ';']
  16
+TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
17 17
 WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('&lt;', '&gt;')]
18 18
 
19 19
 # List of possible strings used for bullets in bulleted lists.
4  tests/regressiontests/defaultfilters/tests.py
@@ -297,6 +297,10 @@ def test_urlize(self):
297 297
         self.assertEqual(urlize('HTTPS://github.com/'),
298 298
             '<a href="https://github.com/" rel="nofollow">HTTPS://github.com/</a>')
299 299
 
  300
+        # Check urlize trims trailing period when followed by parenthesis - see #18644
  301
+        self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
  302
+                         '(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
  303
+
300 304
     def test_wordcount(self):
301 305
         self.assertEqual(wordcount(''), 0)
302 306
         self.assertEqual(wordcount('oneword'), 1)

0 notes on commit d5012d6

Please sign in to comment.
Something went wrong with that request. Please try again.