aboutsummaryrefslogtreecommitdiff
path: root/bleach/callbacks.py
diff options
context:
space:
mode:
authorPer Andersson <avtobiff@gmail.com>2014-01-30 01:25:11 +0100
committerPer Andersson <avtobiff@gmail.com>2014-01-30 01:25:11 +0100
commit6cff86ce6de27fbd4f9fc07716fb1205b14ffae4 (patch)
tree15d1f032fcf000801b69307d2463c10004489ee4 /bleach/callbacks.py
parentfac84c6d90e0875e6c1b10c5ef02d577ee008af4 (diff)
downloadpython-bleach-6cff86ce6de27fbd4f9fc07716fb1205b14ffae4.tar
python-bleach-6cff86ce6de27fbd4f9fc07716fb1205b14ffae4.tar.gz
Imported Upstream version 1.4upstream/1.4
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