diff options
author | Per Andersson <avtobiff@gmail.com> | 2014-01-30 01:25:15 +0100 |
---|---|---|
committer | Per Andersson <avtobiff@gmail.com> | 2014-01-30 01:25:15 +0100 |
commit | c084fbcb2e2f2f167c8d65ca1ecfee406f14c24b (patch) | |
tree | 6c5ca20a48eb50ea000748abb5374247d6de1888 /bleach/callbacks.py | |
parent | 973d326d7847161827a8f75b5f589008a83a342d (diff) | |
parent | 6cff86ce6de27fbd4f9fc07716fb1205b14ffae4 (diff) | |
download | python-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.py | 7 |
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 |