Exemple #1
0
def linkify_changelog(user, changelog, preloaded_person_data=None):
    """Linkify the changelog.

    This obfuscates email addresses to anonymous users, linkifies
    them for non-anonymous and links to the bug page for any bug
    numbers mentioned.
    """
    if changelog is None:
        return ''

    # Remove any email addresses if the user is not logged in.
    changelog = obfuscate_email(user, changelog)

    # CGI Escape the changelog here before further replacements
    # insert HTML. Email obfuscation does not insert HTML but can insert
    # characters that must be escaped.
    changelog = html_escape(changelog)

    # Any email addresses remaining in the changelog were not obfuscated,
    # so we linkify them here.
    changelog = linkify_email(changelog, preloaded_person_data)

    # Ensure any bug numbers are linkified to the bug page.
    changelog = linkify_bug_numbers(changelog)

    return changelog
 def test_explicit_bug_linkification(self):
     text = 'LP: #10'
     self.assertEqual(
         'LP: <a href="/bugs/10" class="bug-link">#10</a>',
         linkify_bug_numbers(text))
Exemple #3
0
 def test_explicit_bug_linkification(self):
     text = 'LP: #10'
     self.assertEqual('LP: <a href="/bugs/10" class="bug-link">#10</a>',
                      linkify_bug_numbers(text))