Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
bug 1269104: Avoid reading missing attribute
Browse files Browse the repository at this point in the history
Revision.previous_revision was optionally added by the TransformManager,
which has been removed.  Instead, use previous_revision directly.
  • Loading branch information
jwhitlock committed Jul 7, 2017
1 parent 8b941c7 commit d6730e8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kuma/wiki/templatetags/jinja_helpers.py
Expand Up @@ -50,18 +50,17 @@ def format_comment(rev, previous_revision=None, load_previous=True):
previous_revision - The previous revision (default None)
load_previous - Try loading previous revision if None (default True)
"""
prev_rev = getattr(rev, 'previous_revision', previous_revision)
if prev_rev is None and load_previous:
prev_rev = rev.previous
if previous_revision is None and load_previous:
previous_revision = rev.previous
comment = bugize_text(rev.comment if rev.comment else "")

# If a page move, say so
if prev_rev and prev_rev.slug != rev.slug:
if previous_revision and previous_revision.slug != rev.slug:
comment += jinja2.Markup(
'<span class="slug-change">'
'<span>%s</span>'
' <i class="icon-long-arrow-right" aria-hidden="true"></i> '
'<span>%s</span></span>') % (prev_rev.slug, rev.slug)
'<span>%s</span></span>') % (previous_revision.slug, rev.slug)

return comment

Expand Down

0 comments on commit d6730e8

Please sign in to comment.