aboutsummaryrefslogtreecommitdiff
path: root/bleach/callbacks.py
diff options
context:
space:
mode:
authorPer Andersson <avtobiff@gmail.com>2014-01-30 01:25:15 +0100
committerPer Andersson <avtobiff@gmail.com>2014-01-30 01:25:15 +0100
commitc084fbcb2e2f2f167c8d65ca1ecfee406f14c24b (patch)
tree6c5ca20a48eb50ea000748abb5374247d6de1888 /bleach/callbacks.py
parent973d326d7847161827a8f75b5f589008a83a342d (diff)
parent6cff86ce6de27fbd4f9fc07716fb1205b14ffae4 (diff)
downloadpython-bleach-c084fbcb2e2f2f167c8d65ca1ecfee406f14c24b.tar
python-bleach-c084fbcb2e2f2f167c8d65ca1ecfee406f14c24b.tar.gz
Merge tag 'upstream/1.4'
Upstream version 1.4 # gpg: Signature made Thu 30 Jan 2014 01:25:12 AM CET using RSA key ID 79F492F8 # gpg: Good signature from "Per Andersson <avtobiff@fripost.org>" # gpg: aka "Per Andersson <avtobiff@debian.org>" # gpg: aka "Per Andersson <avtobiff@gmail.com>" # gpg: aka "Per Andersson <avtobiff@foo.nu>"
Diffstat (limited to 'bleach/callbacks.py')
-rw-r--r--bleach/callbacks.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bleach/callbacks.py b/bleach/callbacks.py
index cc4682d..227f089 100644
--- a/bleach/callbacks.py
+++ b/bleach/callbacks.py
@@ -1,10 +1,15 @@
"""A set of basic callbacks for bleach.linkify."""
+from __future__ import unicode_literals
def nofollow(attrs, new=False):
if attrs['href'].startswith('mailto:'):
return attrs
- attrs['rel'] = 'nofollow'
+ rel = [x for x in attrs.get('rel', '').split(' ') if x]
+ if not 'nofollow' in [x.lower() for x in rel]:
+ rel.append('nofollow')
+ attrs['rel'] = ' '.join(rel)
+
return attrs