Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

Merged
merged 1 commit into from over 1 year ago

3 participants

Vebjorn Ljosa Claude Paroz Florian Apolloner
Vebjorn Ljosa
ljosa commented July 17, 2012

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.

Claude Paroz
Owner

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

Vebjorn Ljosa
ljosa commented July 17, 2012

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

Florian Apolloner apollo13 merged commit 59d9977 into from July 25, 2012
Florian Apolloner apollo13 closed this July 25, 2012
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/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)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.