Merge lp:~cjohnston/launchpad-work-items-tracker/get-bug-assignee into lp:launchpad-work-items-tracker

Proposed by Chris Johnston on 2013-06-17
Status: Merged
Approved by: Chris Johnston on 2013-06-21
Approved revision: 314
Merged at revision: 313
Proposed branch: lp:~cjohnston/launchpad-work-items-tracker/get-bug-assignee
Merge into: lp:launchpad-work-items-tracker
Diff against target: 16 lines (+5/-1)
1 file modified
lpworkitems/collect.py (+5/-1)
To merge this branch: bzr merge lp:~cjohnston/launchpad-work-items-tracker/get-bug-assignee
Reviewer Review Type Date Requested Status
Martin Pitt (community) Approve on 2013-06-21
Chris Johnston Resubmit on 2013-06-21
Andy Doan 2013-06-17 Pending
Review via email: mp+169783@code.launchpad.net

Commit message

Find assignee of the bug and assign it to them.

Description of the change

One way to create work items is to link bugs to tracked blueprints. If the bug is not filed under a tracked project however, there are issues with getting the assignee for the bug. Currently, it just defaults the assignee to whomever is assigned the blueprint. This MP attempts to fix that by checking to see if the bug has a proper assignee, and if so assigns that assignee, otherwise it will continue to assign the assignee of the blueprint.

To post a comment you must log in.
Martin Pitt (pitti) wrote :

The general logic is fine, but I would advise against bare "except:" statements. This will catch any and all exception, even those which would otherwise point out blatant errors in the code such as NameError, SyntaxError, or AttributeError. You can easily and silently break the complete try: block with that. I suggest to rather just except the classes that can realistically happen, and have it actually crash on an unexpected exception.

314. By Chris Johnston on 2013-06-21

Uses better logic for getting bug assignee

Chris Johnston (cjohnston) :
review: Resubmit
Martin Pitt (pitti) wrote :

Looks better, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lpworkitems/collect.py'
2--- lpworkitems/collect.py 2013-01-18 16:42:37 +0000
3+++ lpworkitems/collect.py 2013-06-21 13:24:25 +0000
4@@ -420,7 +420,11 @@
5 return []
6 workitem = models.Workitem()
7 workitem.description = self.get_description(bug)
8- workitem.assignee_name = self.blueprint.assignee_name
9+ if task.assignee_link is None:
10+ workitem.assignee_name = self.blueprint.assignee_name
11+ else:
12+ workitem.assignee_name = models.extract_user_name_from_url(
13+ task.assignee_link)
14 workitem.milestone_name = self.blueprint.milestone_name
15 workitem.status = all_tasks_workitem_state
16 workitem.blueprint = self.blueprint

Subscribers

People subscribed via source and target branches

to all changes: