Merge lp:~jtv/launchpad/recife-policy-invites-allows into lp:~launchpad/launchpad/recife
| Status: | Merged |
|---|---|
| Merged at revision: | 9189 |
| Proposed branch: | lp:~jtv/launchpad/recife-policy-invites-allows |
| Merge into: | lp:~launchpad/launchpad/recife |
| Prerequisite: | lp:~jtv/launchpad/recife-pre-cleanups |
| Diff against target: |
854 lines (+470/-204) 11 files modified
lib/lp/registry/model/distribution.py (+26/-0) lib/lp/registry/model/product.py (+9/-0) lib/lp/registry/model/projectgroup.py (+10/-0) lib/lp/translations/interfaces/potemplate.py (+5/-0) lib/lp/translations/interfaces/translationpolicy.py (+72/-0) lib/lp/translations/model/pofile.py (+11/-171) lib/lp/translations/model/potemplate.py (+14/-5) lib/lp/translations/model/translationpolicy.py (+82/-0) lib/lp/translations/tests/test_potemplate.py (+12/-0) lib/lp/translations/tests/test_translationpolicy.py (+222/-0) lib/lp/translations/utilities/translation_import.py (+7/-28) |
| To merge this branch: | bzr merge lp:~jtv/launchpad/recife-policy-invites-allows |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Māris Fogels (community) | 2010-11-09 | Approve on 2010-11-09 | |
|
Review via email:
|
|||
Commit Message
Recife model's translations access and sharing policies.
Description of the Change
This is a complete overhaul of the translation permissions code. Be warned. It's probably oversized, too, though I've been splitting off lots of work into separate branches to keep sizes down.
The merge target is Recife, a feature branch we've been working on all year.
I hope the best explanation I can give for the new model is in the code itself. But to set the right frame of reference:
* Whether a user can edit a translation, or enter suggestions there was governed by code in the pofile module.
* That code was at least 5 years old, and not unit-tested directly until I replaced the doctest with more systematic unit tests recently.
* Throughout the ages, as empires rose and fell and continents collided and drifted apart, the human race kept piling more checks into the access model but also began using it in more and different ways. Scientists today are hard-pressed to describe exactly what these checks are and aren't meant to be responsible for.
* My apologies for the little David Attenborough speech there. No more National Geographic Channel for me.
* Unfortunately there are still two checks for read-only mode in the "access" checks for POFile. I'd like to clean those up later, but note that during a slow submission they can catch cases where the server goes read-only after the check at the beginning of the request, and so turn oopses into slightly less annoying exceptions.
* We now need even more from the access checks: we need to know whether a translation made in Ubuntu (by a particular person and in a particular language) should be shared with a linked upstream product (if any) or vice versa. We call this issue "sharing policy."
* Sharing policy turns out not to depend on access permissions exactly. It touches on access rights, but is fundamentally a workflow choice.
* Therefore in this branch I tease those two aspects of the access rights apart, and move them into TranslationPolicy. You'll also find sharing policy defined there.
I actually duplicate a lot of testing here. The POFile permissions test I added recently covers much of the same ground as the tests you see here. That was absolutely necessary to guard continuity during these changes. I could possibly slim them down now that we have direct tests on the policy system. On the other hand, the POFile permissions test is structured in a very different way and both seem worthwhile. They may complement each other somewhat. Also of course, I'm not throwing any more changes into this diff!
There are bits of lint left, most of which I intend to clean up after review (together with automated copyright updates and import re-sorting):
{{{
./lib/lp/
1236: Line exceeds 78 characters.
./lib/lp/
72: 'TranslationPer
102: 'ITranslationsP
./lib/lp/
36: 'ITranslationSi
35: 'IPOTemplateSet' imported but unused
36: 'TranslationSide' imported but unused
}}}
The distribution one however is not one I'd like to touch. Better for Registry people to deal with it.
Jeroen
| Jeroen T. Vermeulen (jtv) wrote : | # |
Thanks for going the extra mile (on such a big review) and looking that up! It turns out that one of the two, POTemplate.
Jeroen

Hi Jeroen,
This change looks good. The code and tests are clear, even for someone like myself who is not entirely familiar with the model. In all cases the new code is easier to read than what it replaced.
I mostly looked at changes to test coverage, since you said you overhauled the doctests in preference to unit tests. Given that, are the changes to the translationtarget property tested? What I see represents a big change to the method's return type and type checking.
Similarly, share_with_ other_side( ) changed - is it tested elsewhere as well?
I think the change looks good enough to land as-is, if you want. r=mars