def context_dict(revision, ready_for_l10n=False, revision_approved=False):
    """Return a dict that fills in the blanks in KB notification templates."""
    diff = ''
    l10n = revision.document.revisions.filter(is_ready_for_localization=True)
    approved = revision.document.revisions.filter(is_approved=True)

    if ready_for_l10n and l10n.count() > 1:
        old_rev = l10n.order_by('-created')[1]
        diff = get_diff_for(revision.document, old_rev, revision)
    elif revision_approved and approved.count() > 1:
        old_rev = approved.order_by('-created')[1]
        diff = get_diff_for(revision.document, old_rev, revision)
    elif revision.document.current_revision is not None:
        old_rev = revision.document.current_revision
        diff = get_diff_for(revision.document, old_rev, revision)

    return {
        'document_title': revision.document.title,
        'creator': revision.creator,
        'host': Site.objects.get_current().domain,
        'diff': diff,
        'summary': clean(revision.summary, ALLOWED_TAGS, ALLOWED_ATTRIBUTES),
        'fulltext': clean(revision.content, ALLOWED_TAGS, ALLOWED_ATTRIBUTES),
    }
dataset/ETHPy150Open mozilla/kitsune/kitsune/wiki/events.py/context_dict/original