Merge lp:~thumper/launchpad/package-branch-edit-owner into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Jonathan Lange on 2010-05-24 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 10925 |
| Proposed branch: | lp:~thumper/launchpad/package-branch-edit-owner |
| Merge into: | lp:launchpad |
| Diff against target: |
243 lines (+103/-28) 5 files modified
lib/lp/code/browser/branch.py (+23/-0) lib/lp/code/stories/branches/xx-branch-edit.txt (+47/-1) lib/lp/code/tests/helpers.py (+28/-2) lib/lp/code/tests/test_branch.py (+4/-23) lib/lp/registry/vocabularies.py (+1/-2) |
| To merge this branch: | bzr merge lp:~thumper/launchpad/package-branch-edit-owner |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Jonathan Lange (community) | 2010-05-14 | Approve on 2010-05-24 | |
|
Review via email:
|
|||
Commit Message
Allow branch editors who are not in the owner team to edit the branch details without grabbing ownership of the branch.
Description of the Change
There is a weird edge case in the editing of a branch where the editor has upload permission on the source package, and this gives the user edit permission on the official source package branch. In these cases the current owner of the branch wasn't in the vocabulary that was used for the widget to set the owner, so the default was set to the first value (the user).
Now when this edge case occurs we add the current branch owner in at the start of the vocabulary used in this situation.
pre-impl call: rockstar
tests: xx-branch-edit.txt
As a drive by fix, I noticed that the vocabularies for IPerson were duplicating the code of unique_displayname, so I fixed it.
| Tim Penhey (thumper) wrote : | # |
OK, for the first, since I was testing a widget that was being rendered, it seemed easiest to use a page test as it has the results of the widget being rendered.
I was wanting to use a standard widget (most of the time) for the rendering of the owner drop-down, and I didn't feel like getting into defining a new custom widget type.
Providing a real model method may well be preferable, and if we get to having a special user selector (instead of the search popup widget), then we may well need this.
I've added a comment to the top of the block of commands in the doctest.
| Jonathan Lange (jml) wrote : | # |
Thanks for getting back to me. I like the new comment, and won't block on the other stuff.

Hey Tim,
Weird edge case. Thanks for fixing it up.
* I wish you didn't add to the doctest, and instead added some real unit tests. Don't feel obliged to do anything about this wish.
* If there were a function like get_allowed_ owners( branch, editor) (or a method branch. get_allowed_ owners( editor) ) that returned a list of potential owners, then this wouldn't be an edge case. I guess what I mean is, why did you decide to fix this at the view level rather than the model level?
* The big block of code you add in the doctest could do with some basic prose explanation, e.g. "Create an official branch owned by ~ubuntu-branches, and an editor who has nothing to do with ~ubuntu-branches but is still allowed to edit the branch."
You only need to do something about the last point as far as I'm concerned. Would very much appreciate your thoughts on the first two though.
jml