~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtask.py

  • Committer: Ian Booth
  • Date: 2011-07-20 02:53:15 UTC
  • mto: This revision was merged to the branch mainline in revision 13473.
  • Revision ID: ian.booth@canonical.com-20110720025315-dl1il91xii1egd4x
Tweaks to fix tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
    )
56
56
from operator import attrgetter
57
57
import re
58
 
import transaction
59
58
import urllib
60
59
 
61
60
from lazr.delegates import delegates
247
246
    IUpstreamBugTask,
248
247
    IUpstreamProductBugTaskSearch,
249
248
    UNRESOLVED_BUGTASK_STATUSES,
250
 
    UserCannotEditBugTaskStatus,
251
249
    )
252
250
from lp.bugs.interfaces.bugtracker import BugTrackerType
253
251
from lp.bugs.interfaces.bugwatch import BugWatchActivityStatus
1527
1525
        # happen to be the only values that changed. We explicitly verify that
1528
1526
        # we got a new status and/or assignee, because the form is not always
1529
1527
        # guaranteed to pass all the values. For example: bugtasks linked to a
1530
 
        # bug watch don't allow editing the form, and the value is missing
 
1528
        # bug watch don't allow editting the form, and the value is missing
1531
1529
        # from the form.
1532
1530
        missing = object()
1533
1531
        new_status = new_values.pop("status", missing)
1534
1532
        new_assignee = new_values.pop("assignee", missing)
1535
1533
        if new_status is not missing and bugtask.status != new_status:
1536
1534
            changed = True
1537
 
            try:
1538
 
                bugtask.transitionToStatus(new_status, self.user)
1539
 
            except UserCannotEditBugTaskStatus:
1540
 
                # We need to roll back the transaction at this point,
1541
 
                # since other changes may have been made.
1542
 
                transaction.abort()
1543
 
                self.setFieldError(
1544
 
                    'status',
1545
 
                    "Only the Bug Supervisor for %s can set the bug's "
1546
 
                    "status to %s" %
1547
 
                    (bugtask.target.displayname, new_status.title))
1548
 
                return
 
1535
            bugtask.transitionToStatus(new_status, self.user)
1549
1536
 
1550
1537
        if new_assignee is not missing and bugtask.assignee != new_assignee:
1551
1538
            if new_assignee is not None and new_assignee != self.user: