changeset 5283:d23d70cce785

helpers: cleanup of journal action_parser rev will always have op and ref_name attributes if it is a BaseChangeset or AttributeDict. lazy_cs was undefined for the (apparently rarely hit changeset-not-found case) - fix that by setting the default to False. Title is not relevant when using lazy-cs so there is no need for this h.tooltip invocation.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 23 Jul 2015 00:52:29 +0200
parents d04e36ef71a8
children 5d161c096260
files kallithea/lib/helpers.py
diffstat 1 files changed, 10 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/helpers.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/lib/helpers.py	Thu Jul 23 00:52:29 2015 +0200
@@ -353,12 +353,10 @@
             author = escape(changeset.author)
             date = changeset.date
             message = escape(changeset.message)
-
             tooltip_html = ("<div style='font-size:0.8em'><b>Author:</b>"
                             " %s<br/><b>Date:</b> %s</b><br/><b>Message:"
-                            "</b> %s<br/></div>")
+                            "</b> %s<br/></div>") % (author, date, message)
 
-            tooltip_html = tooltip_html % (author, date, message)
             lnk_format = show_id(changeset)
             uri = link_to(
                     lnk_format,
@@ -618,28 +616,25 @@
         repo_name = user_log.repository.repo_name
 
         def lnk(rev, repo_name):
+            lazy_cs = False
+            title = None
+            _url = '#'
             if isinstance(rev, BaseChangeset) or isinstance(rev, AttributeDict):
-                lazy_cs = True
-                if getattr(rev, 'op', None) and getattr(rev, 'ref_name', None):
-                    lazy_cs = False
-                    lbl = '?'
+                if rev.op and rev.ref_name:
                     if rev.op == 'delete_branch':
                         lbl = '%s' % _('Deleted branch: %s') % rev.ref_name
-                        title = ''
                     elif rev.op == 'tag':
                         lbl = '%s' % _('Created tag: %s') % rev.ref_name
-                        title = ''
-                    _url = '#'
-
+                    else:
+                        lbl = 'Unknown operation %s' % rev.op
                 else:
-                    lbl = '%s' % (rev.short_id[:8])
+                    lazy_cs = True
+                    lbl = rev.short_id[:8]
                     _url = url('changeset_home', repo_name=repo_name,
                                revision=rev.raw_id)
-                    title = tooltip(rev.message)
             else:
-                ## changeset cannot be found/striped/removed etc.
+                # changeset cannot be found - it might have been stripped or removed
                 lbl = ('%s' % rev)[:12]
-                _url = '#'
                 title = _('Changeset not found')
             if parse_cs:
                 return link_to(lbl, _url, title=title, class_='tooltip')
@@ -669,7 +664,6 @@
                     except ChangesetDoesNotExistError:
                         log.error('cannot find revision %s in this repo' % rev)
                         revs.append(rev)
-                        continue
                 else:
                     _rev = AttributeDict({
                         'short_id': rev[:12],