Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #19070 -- urlize filter no longer raises exceptions on 2.7

Thanks to claudep for the patch.
  • Loading branch information...
commit f1be2c7a81b6364e353b351919eca588d288d4a4 1 parent 0dcaddb
Andrew Godwin authored October 31, 2012
2  django/utils/html.py
@@ -18,7 +18,7 @@
18 18
 
19 19
 # Configuration for urlize() function.
20 20
 TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
21  
-WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('&lt;', '&gt;')]
  21
+WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('&lt;', '&gt;')]
22 22
 
23 23
 # List of possible strings used for bullets in bulleted lists.
24 24
 DOTS = ['&middot;', '*', '\u2022', '&#149;', '&bull;', '&#8226;']
7  tests/regressiontests/defaultfilters/tests.py
@@ -304,7 +304,12 @@ def test_urlize(self):
304 304
 
305 305
         # Check urlize trims trailing period when followed by parenthesis - see #18644
306 306
         self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
307  
-                         '(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
  307
+            '(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
  308
+
  309
+        # Check urlize doesn't crash when square bracket is appended to url (#19070)
  310
+        self.assertEqual(urlize('[see www.example.com]'),
  311
+            '[see <a href="http://www.example.com" rel="nofollow">www.example.com</a>]' )
  312
+
308 313
 
309 314
     def test_wordcount(self):
310 315
         self.assertEqual(wordcount(''), 0)

0 notes on commit f1be2c7

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