Merge lp:~wallyworld/launchpad/person-index-timeout-931771 into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | j.c.sackett on 2012-11-01 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 16232 | ||||
| Proposed branch: | lp:~wallyworld/launchpad/person-index-timeout-931771 | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
324 lines (+121/-48) 11 files modified
lib/lp/registry/browser/person.py (+5/-15) lib/lp/registry/interfaces/person.py (+3/-0) lib/lp/registry/model/person.py (+14/-0) lib/lp/security.py (+9/-12) lib/lp/soyuz/browser/archive.py (+4/-0) lib/lp/soyuz/browser/configure.zcml (+0/-3) lib/lp/soyuz/model/archive.py (+63/-0) lib/lp/soyuz/templates/archive-activate.pt (+3/-1) lib/lp/soyuz/templates/archive-macros.pt (+17/-0) lib/lp/soyuz/templates/person-portlet-ppas.pt (+3/-2) lib/lp/soyuz/templates/person-ppas.pt (+0/-15) |
||||
| To merge this branch: | bzr merge lp:~wallyworld/launchpad/person-index-timeout-931771 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| j.c.sackett (community) | 2012-11-01 | Approve on 2012-11-01 | |
|
Review via email:
|
|||
Commit Message
Improve archive permission checks so that visible ppas for a person can be found efficiently.
Description of the Change
== Implementation ==
The root cause of the bug is that the page iterates over all person ppas checking for launchpad.View permission. Each permission check does several queries. I refactored the implementation as follows:
I looked at the permission checking code in the security adaptor and gathered all the rules used to formulate the final database query done for each archive. I coded these rules in a method called get_enabled_
The TAL and view have been refactored to use the new API. To ensure property caching works, I eliminated the subview and converted it to a macro, thus allowing the visible ppas to be loaded once and passed via a variable declaration to the macro.
Finally, I converted other permission checks IArchive in the security adaptors to use the new filter. This was simply to ensure that a common code base was used for the permission checks.
I got wgrant to run the queries on DF to ensure performance was acceptable and a few tweaks were need due to Postgres being "special".
== Tests ==
This is an internal change, so rely on existing tests.
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/

This looks good, Ian, just one minor quibble you can deal with before landing.
#248: If this is meant to get around circular imports, please comment it as
such. It's also cleaner to move imports to the top of the execution scope
they're brought into.