Merge lp:~gmb/launchpad/bug-644346 into lp:launchpad

Proposed by Graham Binns on 2010-09-21
Status: Merged
Approved by: Gavin Panella on 2010-09-21
Approved revision: no longer in the source branch.
Merged at revision: 11618
Proposed branch: lp:~gmb/launchpad/bug-644346
Merge into: lp:launchpad
Diff against target: 21 lines (+4/-3)
1 file modified
lib/lp/bugs/browser/bugwatch.py (+4/-3)
To merge this branch: bzr merge lp:~gmb/launchpad/bug-644346
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve on 2010-09-21
Launchpad code reviewers code 2010-09-21 Pending
Review via email: mp+36143@code.launchpad.net

Commit Message

When a bug watch is deleted, the success notification will be added to the response after the deletion happens rather than before.

Description of the Change

This branch fixes bug 644346 by moving the code that adds the success notification for deleting a watch to *after* the point where the watch is deleted.

To post a comment you must log in.
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugwatch.py'
2--- lib/lp/bugs/browser/bugwatch.py 2010-08-27 10:00:21 +0000
3+++ lib/lp/bugs/browser/bugwatch.py 2010-09-23 09:02:48 +0000
4@@ -141,13 +141,14 @@
5 @action('Delete Bug Watch', name='delete', condition=bugWatchIsUnlinked)
6 def delete_action(self, action, data):
7 bugwatch = self.context
8- self.request.response.addInfoNotification(
9- structured(
10+ # Build the notification first, whilst we still have the data.
11+ notification_message = structured(
12 'The <a href="%(url)s">%(bugtracker)s #%(remote_bug)s</a>'
13 ' bug watch has been deleted.',
14 url=bugwatch.url, bugtracker=bugwatch.bugtracker.name,
15- remote_bug=bugwatch.remotebug))
16+ remote_bug=bugwatch.remotebug)
17 bugwatch.bug.removeWatch(bugwatch, self.user)
18+ self.request.response.addInfoNotification(notification_message)
19
20 def showResetActionCondition(self, action):
21 """Return True if the reset action can be shown to this user."""