Merge lp:~jcsackett/launchpad/private-team-to-private-team-519306 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Brad Crittenden |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11639 |
Proposed branch: | lp:~jcsackett/launchpad/private-team-to-private-team-519306 |
Merge into: | lp:launchpad |
Diff against target: |
152 lines (+64/-9) 4 files modified
lib/lp/registry/browser/tests/test_person_webservice.py (+1/-0) lib/lp/registry/interfaces/person.py (+9/-4) lib/lp/registry/tests/test_project.py (+3/-5) lib/lp/registry/tests/test_team_webservice.py (+51/-0) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/private-team-to-private-team-519306 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brad Crittenden (community) | code | Approve | |
Review via email: mp+36589@code.launchpad.net |
Commit message
Uses expose() on an exception in team validator so that the exception is properly passed through the API, rather than OOPSing.
Description of the change
Summary
=======
Exposes an exception across the API when a bad attempt is made to link private teams. This prevents the OOPS from the related bug.
Proposed Fix
============
Wrap the exception normally returned by the validator for the website in the expose method and tie it to a 403 error.
Implementation details
=======
Largely as in proposed fix. Instead of 403, it returns a 400, as webservice_error reverts to that if the exception is called from deeper in the call stack than the API named method. As this occurs in the validator, it will always be a 400 so the code reflects that.
Tests
=====
bin/test -t test_team_
Demo and Q/A
============
Use launchpadlib to connect launchpad.dev; try to add one private team as a member to another (as the owner of both teams). You will get an HTTP 400 response.
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
Looks good Jon with these comments:
1) use httplib.BAD_REQUEST instead of a raw 400 throughout your changes. Please leave the comment that shows the raw number.
2) run utilities/ format- imports on your changed files. Easier than me pointing out the issues.
3) 'e' is a pretty recognized variable for an exception but we still try to avoid one letter variables, save for i,j,k loop variables.