Merge lp:~deryck/launchpad/bug-activity-do-not-snapshot-680131 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: no longer in the source branch.
Merged at revision: 13107
Proposed branch: lp:~deryck/launchpad/bug-activity-do-not-snapshot-680131
Merge into: lp:launchpad
Diff against target: 45 lines (+8/-3)
3 files modified
lib/lp/bugs/interfaces/bug.py (+2/-2)
lib/lp/bugs/tests/test_bug.py (+4/-0)
lib/lp/bugs/tests/test_bugs_webservice.py (+2/-1)
To merge this branch: bzr merge lp:~deryck/launchpad/bug-activity-do-not-snapshot-680131
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+62035@code.launchpad.net

Commit message

[r=sinzui][bug=680131] Add doNotSnapshot to IBug.activity to fix OOPS when marking yourself as affected by a bug.

Description of the change

This makes sure bug activity is not snapshotted to keep from OOPSing when a bug is marked as affecting a user. This happens on bug 1 as noted in bug 680131. I chatted with Curtis about how to fix this long term, so we don't have to continually doNotSnapshot CollectionFields. But I spotted the offending attribute on IBug while working today and thought it an easy enough fix to land right away.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

I should mention to, I will continue to work on the better, long term fix for this, too. This is just an immediate fix to close the current bug.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/interfaces/bug.py'
2--- lib/lp/bugs/interfaces/bug.py 2011-05-12 21:33:10 +0000
3+++ lib/lp/bugs/interfaces/bug.py 2011-05-23 20:57:30 +0000
4@@ -248,10 +248,10 @@
5 displayname = TextLine(title=_("Text of the form 'Bug #X"),
6 readonly=True)
7 activity = exported(
8- CollectionField(
9+ doNotSnapshot(CollectionField(
10 title=_('Log of activity that has occurred on this bug.'),
11 value_type=Reference(schema=IBugActivity),
12- readonly=True))
13+ readonly=True)))
14 initial_message = Attribute(
15 "The message that was specified when creating the bug")
16 bugtasks = exported(
17
18=== modified file 'lib/lp/bugs/tests/test_bug.py'
19--- lib/lp/bugs/tests/test_bug.py 2011-05-10 14:19:24 +0000
20+++ lib/lp/bugs/tests/test_bug.py 2011-05-23 20:57:30 +0000
21@@ -151,6 +151,10 @@
22 [token for token in sql_tokens
23 if token.startswith('message')],
24 [])
25+ self.assertEqual(
26+ [token for token in sql_tokens
27+ if token.startswith('bugactivity')],
28+ [])
29
30
31 class TestBugCreation(TestCaseWithFactory):
32
33=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
34--- lib/lp/bugs/tests/test_bugs_webservice.py 2011-05-17 20:16:47 +0000
35+++ lib/lp/bugs/tests/test_bugs_webservice.py 2011-05-23 20:57:30 +0000
36@@ -305,7 +305,8 @@
37 # bug subscriptions and (un)affected users.
38 for field_name in (
39 'subscriptions', 'users_affected', 'users_unaffected',
40- 'users_affected_with_dupes', 'messages'):
41+ 'users_affected_with_dupes', 'messages', 'attachments',
42+ 'activity'):
43 self.failUnless(
44 IDoNotSnapshot.providedBy(IBug[field_name]),
45 'IBug.%s should not be included in snapshots, see bug 507642.'