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
=== modified file 'lib/lp/bugs/interfaces/bug.py'
--- lib/lp/bugs/interfaces/bug.py 2011-05-12 21:33:10 +0000
+++ lib/lp/bugs/interfaces/bug.py 2011-05-23 20:57:30 +0000
@@ -248,10 +248,10 @@
248 displayname = TextLine(title=_("Text of the form 'Bug #X"),248 displayname = TextLine(title=_("Text of the form 'Bug #X"),
249 readonly=True)249 readonly=True)
250 activity = exported(250 activity = exported(
251 CollectionField(251 doNotSnapshot(CollectionField(
252 title=_('Log of activity that has occurred on this bug.'),252 title=_('Log of activity that has occurred on this bug.'),
253 value_type=Reference(schema=IBugActivity),253 value_type=Reference(schema=IBugActivity),
254 readonly=True))254 readonly=True)))
255 initial_message = Attribute(255 initial_message = Attribute(
256 "The message that was specified when creating the bug")256 "The message that was specified when creating the bug")
257 bugtasks = exported(257 bugtasks = exported(
258258
=== modified file 'lib/lp/bugs/tests/test_bug.py'
--- lib/lp/bugs/tests/test_bug.py 2011-05-10 14:19:24 +0000
+++ lib/lp/bugs/tests/test_bug.py 2011-05-23 20:57:30 +0000
@@ -151,6 +151,10 @@
151 [token for token in sql_tokens151 [token for token in sql_tokens
152 if token.startswith('message')],152 if token.startswith('message')],
153 [])153 [])
154 self.assertEqual(
155 [token for token in sql_tokens
156 if token.startswith('bugactivity')],
157 [])
154158
155159
156class TestBugCreation(TestCaseWithFactory):160class TestBugCreation(TestCaseWithFactory):
157161
=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
--- lib/lp/bugs/tests/test_bugs_webservice.py 2011-05-17 20:16:47 +0000
+++ lib/lp/bugs/tests/test_bugs_webservice.py 2011-05-23 20:57:30 +0000
@@ -305,7 +305,8 @@
305 # bug subscriptions and (un)affected users.305 # bug subscriptions and (un)affected users.
306 for field_name in (306 for field_name in (
307 'subscriptions', 'users_affected', 'users_unaffected',307 'subscriptions', 'users_affected', 'users_unaffected',
308 'users_affected_with_dupes', 'messages'):308 'users_affected_with_dupes', 'messages', 'attachments',
309 'activity'):
309 self.failUnless(310 self.failUnless(
310 IDoNotSnapshot.providedBy(IBug[field_name]),311 IDoNotSnapshot.providedBy(IBug[field_name]),
311 'IBug.%s should not be included in snapshots, see bug 507642.'312 'IBug.%s should not be included in snapshots, see bug 507642.'