How to use the bleach.callbacks.nofollow function in bleach

To help you get started, we’ve selected a few bleach examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / bleach / tests / test_callbacks.py View on Github external
def test_has_nofollow_already(self):
        attrs = {
            (None, 'href'): 'http://example.com',
            (None, 'rel'): 'nofollow',
        }
        assert nofollow(attrs) == attrs
github mozilla / bleach / tests / test_callbacks.py View on Github external
def test_mailto(self):
        attrs = {(None, 'href'): 'mailto:joe@example.com'}
        assert nofollow(attrs) == attrs
github mozilla / bleach / tests / test_callbacks.py View on Github external
def test_other_rel(self):
        attrs = {
            (None, 'href'): 'http://example.com',
            (None, 'rel'): 'next',
        }
        assert (
            nofollow(attrs) ==
            {(None, 'href'): 'http://example.com', (None, 'rel'): 'next nofollow'}
        )
github CenterForOpenScience / osf.io / website / addons / wiki / model.py View on Github external
def html(self, node):
        """The cleaned HTML of the page"""
        sanitized_content = render_content(self.content, node=node)
        try:
            return linkify(
                sanitized_content,
                [nofollow, ],
            )
        except TypeError:
            logger.warning('Returning unlinkified content.')
            return sanitized_content