Mercurial > p > roundup > code
diff test/test_templating.py @ 5190:89b1870b1bc9
Make url's in messages identified as http://... or https://...
have the rel="nofollow" attribute to reduce the value
of spamming public trackers.
Internal links: issue20 msg10 etc. won't have the nofollow attribute.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 25 Feb 2017 21:01:50 -0500 |
| parents | ae2a5d1afdd5 |
| children | a9ace22e0a2f |
line wrap: on
line diff
--- a/test/test_templating.py Sat Feb 25 17:48:46 2017 -0500 +++ b/test/test_templating.py Sat Feb 25 21:01:50 2017 -0500 @@ -178,37 +178,37 @@ ae = self.assertEqual ae(t('item123123123123'), 'item123123123123') ae(t('http://roundup.net/'), - '<a href="http://roundup.net/">http://roundup.net/</a>') + '<a href="http://roundup.net/" rel="nofollow">http://roundup.net/</a>') ae(t('<HTTP://roundup.net/>'), - '<<a href="HTTP://roundup.net/">HTTP://roundup.net/</a>>') + '<<a href="HTTP://roundup.net/" rel="nofollow">HTTP://roundup.net/</a>>') ae(t('<http://roundup.net/>.'), - '<<a href="http://roundup.net/">http://roundup.net/</a>>.') + '<<a href="http://roundup.net/" rel="nofollow">http://roundup.net/</a>>.') ae(t('<www.roundup.net>'), - '<<a href="http://www.roundup.net">www.roundup.net</a>>') + '<<a href="http://www.roundup.net" rel="nofollow">www.roundup.net</a>>') ae(t('(www.roundup.net)'), - '(<a href="http://www.roundup.net">www.roundup.net</a>)') + '(<a href="http://www.roundup.net" rel="nofollow">www.roundup.net</a>)') ae(t('foo http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx bar'), - 'foo <a href="http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx">' + 'foo <a href="http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx" rel="nofollow">' 'http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx</a> bar') ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language))'), - '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">' + '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)" rel="nofollow">' 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>)') ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language)).'), - '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">' + '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)" rel="nofollow">' 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>).') ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language))>.'), - '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)">' + '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language)" rel="nofollow">' 'http://en.wikipedia.org/wiki/Python_(programming_language)</a>)>.') ae(t('(e.g. http://en.wikipedia.org/wiki/Python_(programming_language>)).'), - '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language">' + '(e.g. <a href="http://en.wikipedia.org/wiki/Python_(programming_language" rel="nofollow">' 'http://en.wikipedia.org/wiki/Python_(programming_language</a>>)).') for c in '.,;:!': # trailing punctuation is not included ae(t('http://roundup.net/%c ' % c), - '<a href="http://roundup.net/">http://roundup.net/</a>%c ' % c) + '<a href="http://roundup.net/" rel="nofollow">http://roundup.net/</a>%c ' % c) # but it's included if it's part of the URL ae(t('http://roundup.net/%c/' % c), - '<a href="http://roundup.net/%c/">http://roundup.net/%c/</a>' % (c, c)) + '<a href="http://roundup.net/%c/" rel="nofollow">http://roundup.net/%c/</a>' % (c, c)) ''' class HTMLPermissions:
