BlameOutput no longer takes an object of a Changes class as argument.

This is unnecessary as there is a get() function inside the changes module
to fetch an object of this class, so we can fetch this directly in
BlameOutput.__init__().
This commit is contained in:
Adam Waldenberg 2013-07-25 14:37:19 +02:00
parent 772cef01d4
commit 353f8daee1
2 changed files with 5 additions and 5 deletions

View File

@ -23,6 +23,7 @@ from localization import N_
from outputable import Outputable from outputable import Outputable
from changes import FileDiff from changes import FileDiff
import comment import comment
import changes
import filtering import filtering
import format import format
import gravatar import gravatar
@ -151,9 +152,9 @@ BLAME_INFO_TEXT = N_("Below are the number of rows from each author that have su
"intact in the current revision") "intact in the current revision")
class BlameOutput(Outputable): class BlameOutput(Outputable):
def __init__(self, changes, hard): def __init__(self, hard):
self.hard = hard self.hard = hard
self.changes = changes self.changes = changes.get(hard)
Outputable.__init__(self) Outputable.__init__(self)
def output_html(self): def output_html(self):
@ -173,11 +174,10 @@ class BlameOutput(Outputable):
for i, entry in enumerate(blames): for i, entry in enumerate(blames):
work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames)) work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
author_email = self.changes.get_author_email(entry[0])
blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">") blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")
if format.get_selected() == "html": if format.get_selected() == "html":
author_email = self.changes.get_author_email(entry[0])
blame_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(author_email), entry[0]) blame_xml += "<td><img src=\"{0}\"/>{1}</td>".format(gravatar.get_url(author_email), entry[0])
else: else:
blame_xml += "<td>" + entry[0] + "</td>" blame_xml += "<td>" + entry[0] + "</td>"

View File

@ -78,7 +78,7 @@ class Runner:
outputable.output(changes.ChangesOutput(self.hard)) outputable.output(changes.ChangesOutput(self.hard))
if changes.get(self.hard).get_commits(): if changes.get(self.hard).get_commits():
outputable.output(blame.BlameOutput(changes.get(self.hard), self.hard)) outputable.output(blame.BlameOutput(self.hard))
if self.timeline: if self.timeline:
outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks)) outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))