=== modified file 'lpwhip/main.py' --- lpwhip/main.py 2010-12-23 15:11:02 +0000 +++ lpwhip/main.py 2010-12-23 15:31:55 +0000 @@ -1,6 +1,6 @@ from itertools import chain, imap -from operator import attrgetter import os +import urlparse from launchpadlib.launchpad import Launchpad from launchpadlib.uris import LPNET_SERVICE_ROOT @@ -115,6 +115,14 @@ def __str__(self): return self._lp_branch.bzr_identity + @property + def web_url(self): + return 'https://code.launchpad.net/+branch/%s' % ( + self._lp_branch.unique_name,) + + def to_html(self): + return '%s' % (self.web_url, str(self)) + class MergeProposal(object): @@ -137,6 +145,14 @@ def status(self): return self._lp_mp.queue_status + @property + def web_url(self): + path = urlparse.urlparse(self._lp_mp.self_link).path.lstrip('/') + return 'https://code.launchpad.net/%s' % path.split('/', 1)[1] + + def to_html(self): + return '%s' % (self.web_url, str(self)) + def __str__(self): return '%s => %s' % (self.source_branch, self.target_branch) @@ -154,9 +170,16 @@ def target(self): return Target(self._lp_bugtask.target) + @property + def web_url(self): + return 'http://pad.lv/%s' % (self.bug_id,) + def __str__(self): return '%s (%s)' % (self._lp_bugtask.title, self._lp_bugtask.status) + def to_html(self): + return '%s' % (self.web_url, str(self)) + class Target(object): @@ -170,6 +193,13 @@ def name(self): return self._lp_target.name + @property + def web_url(self): + return 'https://launchpad.net/%s' % (self.name,) + + def to_html(self): + return '%s' % (self.web_url, str(self)) + class Dashboard(object): @@ -239,8 +269,23 @@ print ' * %s' % (item,) print + def to_html(self): + targets = self.grouped_by_target(ordered=True) + print ('%s' + % (self._person.name,)) + print '

%s work-in-progress

' % (self._person.name,) + for name, items in targets: + print '

%s

' % (name,) + for item_type, item_values in items: + print '

%s

' % (item_type,) + print '' + print '' + def dump(self): - self.summary_by_target() + self.to_html() def run(args):