Fixed #19070 -- urlize filter no longer raises exceptions on 2.7
Thanks to claudep for the patch.
This commit is contained in:
parent
146ed13a11
commit
7f75460fd6
|
@ -18,7 +18,7 @@ from django.utils.text import normalize_newlines
|
||||||
|
|
||||||
# Configuration for urlize() function.
|
# Configuration for urlize() function.
|
||||||
TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
|
TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
|
||||||
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('<', '>')]
|
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('<', '>')]
|
||||||
|
|
||||||
# List of possible strings used for bullets in bulleted lists.
|
# List of possible strings used for bullets in bulleted lists.
|
||||||
DOTS = ['·', '*', '\u2022', '•', '•', '•']
|
DOTS = ['·', '*', '\u2022', '•', '•', '•']
|
||||||
|
|
|
@ -304,7 +304,12 @@ class DefaultFiltersTests(TestCase):
|
||||||
|
|
||||||
# Check urlize trims trailing period when followed by parenthesis - see #18644
|
# Check urlize trims trailing period when followed by parenthesis - see #18644
|
||||||
self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
|
self.assertEqual(urlize('(Go to http://www.example.com/foo.)'),
|
||||||
'(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
|
'(Go to <a href="http://www.example.com/foo" rel="nofollow">http://www.example.com/foo</a>.)')
|
||||||
|
|
||||||
|
# Check urlize doesn't crash when square bracket is appended to url (#19070)
|
||||||
|
self.assertEqual(urlize('[see www.example.com]'),
|
||||||
|
'[see <a href="http://www.example.com" rel="nofollow">www.example.com</a>]' )
|
||||||
|
|
||||||
|
|
||||||
def test_wordcount(self):
|
def test_wordcount(self):
|
||||||
self.assertEqual(wordcount(''), 0)
|
self.assertEqual(wordcount(''), 0)
|
||||||
|
|
Loading…
Reference in New Issue