mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #13704 -- Handled IDN properly in the urlize template filter. Thanks Claude Paroz for the initial version of the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17348 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -238,6 +238,7 @@ class DefaultFiltersTests(TestCase):
|
||||
# Check urlize with https addresses
|
||||
self.assertEqual(urlize('https://google.com'),
|
||||
u'<a href="https://google.com" rel="nofollow">https://google.com</a>')
|
||||
|
||||
# Check urlize doesn't overquote already quoted urls - see #9655
|
||||
self.assertEqual(urlize('http://hi.baidu.com/%D6%D8%D0%C2%BF'),
|
||||
u'<a href="http://hi.baidu.com/%D6%D8%D0%C2%BF" rel="nofollow">'
|
||||
@@ -252,6 +253,16 @@ class DefaultFiltersTests(TestCase):
|
||||
u'<a href="http://en.wikipedia.org/wiki/Caf%C3%A9" rel="nofollow">'
|
||||
u'http://en.wikipedia.org/wiki/Café</a>')
|
||||
|
||||
# Check urlize handles IDN correctly - see #13704
|
||||
self.assertEqual(urlize('http://c✶.ws'),
|
||||
u'<a href="http://xn--c-lgq.ws" rel="nofollow">http://c✶.ws</a>')
|
||||
self.assertEqual(urlize('www.c✶.ws'),
|
||||
u'<a href="http://www.xn--c-lgq.ws" rel="nofollow">www.c✶.ws</a>')
|
||||
self.assertEqual(urlize('c✶.org'),
|
||||
u'<a href="http://xn--c-lgq.org" rel="nofollow">c✶.org</a>')
|
||||
self.assertEqual(urlize('info@c✶.org'),
|
||||
u'<a href="mailto:info@xn--c-lgq.org">info@c✶.org</a>')
|
||||
|
||||
def test_wordcount(self):
|
||||
self.assertEqual(wordcount(''), 0)
|
||||
self.assertEqual(wordcount(u'oneword'), 1)
|
||||
|
||||
Reference in New Issue
Block a user