Merge lp:~gmb/launchpad/extract-subscription-view-bug-651240 into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Graham Binns on 2010-10-06 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 11702 | ||||
| Proposed branch: | lp:~gmb/launchpad/extract-subscription-view-bug-651240 | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
618 lines (+276/-205) 7 files modified
lib/lp/bugs/browser/bugsubscription.py (+257/-2) lib/lp/bugs/browser/bugtask.py (+7/-197) lib/lp/bugs/browser/configure.zcml (+1/-1) lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt (+2/-2) lib/lp/bugs/templates/bug-subscription.pt (+1/-1) lib/lp/registry/browser/person.py (+7/-1) lib/lp/registry/stories/person/xx-person-subscriptions.txt (+1/-1) |
||||
| To merge this branch: | bzr merge lp:~gmb/launchpad/extract-subscription-view-bug-651240 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Abel Deuring (community) | code | 2010-10-06 | Approve on 2010-10-06 |
|
Review via email:
|
|||
Commit Message
The Bug:+subscribe functionality has been moved into its own view class.
Description of the Change
This branch fixes bug 651240 by moving the +subscription-
out of BugTaskView (where it has been since pretty much the dawn of
time) and into its own view. The majority of changes in this branch are
code moves as a result.
== lib/lp/
- I've added a new view, BugSubscription
all the work that BugTask used to do when it was hit via the
+subscription URL.
== lib/lp/
- There's an XXX here that I need to discuss with lifeless. Basically,
the functionally empty for loop actually makes the view more
efficient (in terms of queries run anyway) because, I presume, it
causes the materialised objects to be cached by Storm. Removing it
causes the test that ensures that querie counts remain reasonable to
fail. I will hopefully remove this XXX-and-for-loop before landing,
but it seems silly to block the review because of it.
- I've moved all the +subscribe functionality out of BugTaskView.
== lib/lp/
- I've updated the ZCML to reflect the code move.
== lib/lp/
- I've altered the form's action. For some reason the old version
caused the view to break, though I've no idea why (basically it would
never actually do anything with action=".". Suggestions as to reasons
for this are welcome). Note that this form is going away in a
subsequent branch and being replaced with the launchpadform macro.
| Robert Collins (lifeless) wrote : | # |

Graham, I have a few thoughts for you.
Firstly, consider (by consider I mean 'I really think you should do
this') writing specific tests for query scaling for the new view.
Secondly, the empty loop can be rephrased as getSubscribersF orPerson( self.user) )
list(bug.
This is eager loading the subscriber data.
*if* you arrange for the new view to be initialized before doing any
dereferencing of people in the main view, you can just trigger that
eager load in the subscribers view. If you can't arrange that, then
you've got two bugs:
1) you're adding a new query that isn't needed (you don't see this
because the scaling tests have a little fat - but check the counts
before and after, you'll see the extra query)
2) its being run too late to eager load anything.
you could make getSubscribersF orPerson return a cached object, but
frankly I suspect that the problem is zope's wiring up of views and
subordinate things : death by a thousand cuts is a designed in feature
there, so moving all use of subscribers out of the main view is likely
the only way out of this.
Clearly this needs fixing - we don't want to make the page slower,
which this patch will do at the moment.
-Rob