Loading django/utils/html.py +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ DOTS = ['·', '*', '\u2022', '•', '•', '•'] unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)') unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})') word_split_re = re.compile(r'(\s+)') simple_url_re = re.compile(r'^https?://\w', re.IGNORECASE) simple_url_re = re.compile(r'^https?://\[?\w', re.IGNORECASE) simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$', re.IGNORECASE) simple_email_re = re.compile(r'^\S+@\S+\.\S+$') link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') Loading tests/defaultfilters/tests.py +5 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,11 @@ class DefaultFiltersTests(TestCase): self.assertEqual(urlize('see test[at[example.com'), 'see <a href="http://test[at[example.com" rel="nofollow">test[at[example.com</a>' ) # Check urlize works with IPv4/IPv6 addresses self.assertEqual(urlize('http://192.168.0.15/api/9'), '<a href="http://192.168.0.15/api/9" rel="nofollow">http://192.168.0.15/api/9</a>') self.assertEqual(urlize('http://[2001:db8:cafe::2]/api/9'), '<a href="http://[2001:db8:cafe::2]/api/9" rel="nofollow">http://[2001:db8:cafe::2]/api/9</a>') def test_wordcount(self): self.assertEqual(wordcount(''), 0) Loading Loading
django/utils/html.py +1 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ DOTS = ['·', '*', '\u2022', '•', '•', '•'] unencoded_ampersands_re = re.compile(r'&(?!(\w+|#\d+);)') unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})') word_split_re = re.compile(r'(\s+)') simple_url_re = re.compile(r'^https?://\w', re.IGNORECASE) simple_url_re = re.compile(r'^https?://\[?\w', re.IGNORECASE) simple_url_2_re = re.compile(r'^www\.|^(?!http)\w[^@]+\.(com|edu|gov|int|mil|net|org)$', re.IGNORECASE) simple_email_re = re.compile(r'^\S+@\S+\.\S+$') link_target_attribute_re = re.compile(r'(<a [^>]*?)target=[^\s>]+') Loading
tests/defaultfilters/tests.py +5 −0 Original line number Diff line number Diff line Loading @@ -314,6 +314,11 @@ class DefaultFiltersTests(TestCase): self.assertEqual(urlize('see test[at[example.com'), 'see <a href="http://test[at[example.com" rel="nofollow">test[at[example.com</a>' ) # Check urlize works with IPv4/IPv6 addresses self.assertEqual(urlize('http://192.168.0.15/api/9'), '<a href="http://192.168.0.15/api/9" rel="nofollow">http://192.168.0.15/api/9</a>') self.assertEqual(urlize('http://[2001:db8:cafe::2]/api/9'), '<a href="http://[2001:db8:cafe::2]/api/9" rel="nofollow">http://[2001:db8:cafe::2]/api/9</a>') def test_wordcount(self): self.assertEqual(wordcount(''), 0) Loading