Merge lp:~jtv/launchpad/cache-pofile-view-permissions into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Jeroen T. Vermeulen |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11989 |
Proposed branch: | lp:~jtv/launchpad/cache-pofile-view-permissions |
Merge into: | lp:launchpad |
Diff against target: |
69 lines (+10/-12) 2 files modified
lib/lp/translations/browser/pofile.py (+8/-8) lib/lp/translations/browser/translationmessage.py (+2/-4) |
To merge this branch: | bzr merge lp:~jtv/launchpad/cache-pofile-view-permissions |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+41930@code.launchpad.net |
Commit message
[r=adeuring]
Description of the change
= Bug 297136 =
This should strip a few dozen pointlessly repeated queries off the performance-
My branch effectively hoists a few very similar checks from the individual message views up into the surrounding POFile page view (if any). The checks all depend on the relationship between the user and the POFile, and global system state. Neither will ever differ between messages on the same translate page.
(There's also a very minor cleanup of list handling at the end).
(10:52:35) adeuring: jtv: IN line 37 of the diff, you run "if self.form_ is_writeable: " for each loop iteration. I think you can move the "if" outside the loop ion... setPOFile( alt_pofile) " from line 49 go to? Or is it simply unnecessary?
(10:53:06) jtv: adeuring: true… it's a cachedproperty, but with this short a loop I guess that makes sense.
(10:53:41) adeuring: jtv: yeah, that's a real micro-optimisat
(10:53:42) ***jtv looks again
(10:53:59) jtv: Heh, I had missed how completely nonsensical the loop becomes in one of the two cases. :)
(10:54:50) adeuring: ;)
(10:54:57) jtv: And now it becomes clear that this is just one big list comprehension.
(10:55:48) adeuring: jtv: perhaps I had not have yet enogh coffee -- but where did the "alt_current.
(10:58:15) jtv: adeuring: that's what made me clean this up—alt_current goes into alt_submissions, which is really just [alt_current] + alt_external, so at the end I just have to loop over alt_submissions instead of alt_external.
(10:58:44) adeuring: jtv: ah, thanks! r=me, then.