Merge lp:~gmb/launchpad/fix-bugwatch-message-shenanigans into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2010-09-30 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11661 |
| Proposed branch: | lp:~gmb/launchpad/fix-bugwatch-message-shenanigans |
| Merge into: | lp:launchpad |
| Diff against target: |
195 lines (+98/-6) 6 files modified
lib/lp/bugs/browser/bugwatch.py (+4/-1) lib/lp/bugs/browser/tests/test_bugwatch_views.py (+56/-0) lib/lp/bugs/doc/bugmessage.txt (+10/-0) lib/lp/bugs/model/bugwatch.py (+14/-1) lib/lp/bugs/stories/bugwatches/xx-delete-bugwatch.txt (+2/-3) lib/lp/bugs/tests/test_bugwatch.py (+12/-1) |
| To merge this branch: | bzr merge lp:~gmb/launchpad/fix-bugwatch-message-shenanigans |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Edwin Grubbs (community) | code | 2010-09-29 | Approve on 2010-09-29 |
|
Review via email:
|
|||
Commit Message
Users should no longer be able to attempt to delete a BugWatch that is linked to BugComments.
Description of the Change
This branch began as an attempt to fix bug 575911 (Trying to delete a
bug watch results in a non-OOPSing IntegrityError). The error was being
raised because we were allowing people to attempt to delete bug watches
which had comments linked to them. Since we don't do a cascading delete
on comments linked to watches, Postgres threw its toys out of the pram.
It turned out that the simplest way to stop the error from being raise
was to stop people from ever getting to the point where they could try
to delete a linked watch in the first place. The fact that the error
didn't OOPS was due to it occurring when the transaction was being
committed, which is (apparently) outside application code and so not
handled by the OOPS machinery.
Nevertheless I've followed Gavin's suggestion of adding a store.flush()
call to the end of BugWatch.
possible for someone to try to delete a linked watch without getting a
sane error message the flush() should force any DB errors to be handled
by the OOPS machinery, thus making life easier should anything else go
wrong.
Here's a list of my changes:
== lib/lp/
- I've updated the bugWatchIsUnlin
determine whether ot display the delete action on the page. It now
checks that the watch has no comments linked to it.
== lib/lp/
- I've added a couple of tests to cover the changes to
bugWatchIsUn
== lib/lp/
- I've added tests to ensure that comments aren't linked to a watch
when a watch is created from a URL in a comment. This was originally
thought to be the source of (part of) the bug I was attempting to
fix. That turned out not to be the case but it seemed sensible to
leave the test in place.
== lib/lp/
- BugWatch.
watch is linked to a task or comments. I've added a call to
store.flush() as described above.
== lib/lp/
- I've updated the narrative for the deletion story.
== lib/lp/
- I've added a test to check that BugWatch.
BugWatchDele
| Graham Binns (gmb) wrote : | # |
On 29 September 2010 18:41, Edwin Grubbs <email address hidden> wrote:
> Review: Approve code
> Hi Graham,
>
> This branch looks good. Can you make sure there is a bug open about the oops machinery not reporting late integrity errors?
Gary filed bug 647103 about this problem. I've added an XXX referring
to it above the flush(), since we shouldn't have to do it.
| Graham Binns (gmb) wrote : | # |
On 29 September 2010 18:41, Edwin Grubbs <email address hidden> wrote:
> Review: Approve code
> Hi Graham,
>
> This branch looks good. Can you make sure there is a bug open about the oops machinery not reporting late integrity errors?
Gary filed bug 647103 about this problem. I've added an XXX referring
to it above the flush(), since we shouldn't have to do it.

Hi Graham,
This branch looks good. Can you make sure there is a bug open about the oops machinery not reporting late integrity errors?
-Edwin