Merge lp:~jcsackett/launchpad/bad-state-transition-641266 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Graham Binns |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11660 |
Proposed branch: | lp:~jcsackett/launchpad/bad-state-transition-641266 |
Merge into: | lp:launchpad |
Diff against target: |
151 lines (+100/-6) 4 files modified
lib/canonical/launchpad/interfaces/__init__.py (+1/-0) lib/lp/registry/errors.py (+20/-0) lib/lp/registry/model/teammembership.py (+11/-6) lib/lp/registry/tests/test_teammembership_webservice.py (+68/-0) |
To merge this branch: | bzr merge lp:~jcsackett/launchpad/bad-state-transition-641266 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Graham Binns (community) | code | Approve | |
Review via email: mp+36726@code.launchpad.net |
Commit message
Restructure stacked assertions into exceptions based on conditionals to provide appropriate errors to API users instead of OOPSing.
Description of the change
Summary
=======
Exposes an API error and refactors some assertions to more cleanly deal with an error condition across the API instead of OOPSing.
Proposed Fix
============
Rather than the stacked asserts in the setStatus method, implement a conditional tree to check each condition and raise a new Error class related to bad transitions that has been registered with the webservice.
Pre-Implementation Talk
=======
Spoke with Curtis Hovey about the error conditions and API usage.
Spoke further with Aaron Bentley about appropriate exposure of Exceptions across the API.
Implementation details
=======
As in proposed.
Tests
=====
bin/test -t test_teammember
Demo and Q/A
============
Use launchpadlib to connect launchpad.dev. Either create or find a team and retrieve one of its teammembership entries. Attempt to setStatus to one that isn't valid for the current (e.g. switch to Proposed from Approved).
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/canonical
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
569: Line exceeds 78 characters.
I can see no clear way to shorten the line on 569; as it predates this branch, I've elected to leave it alone, but welcome suggestions to clean it up.
There are a horde of errors in canonical.
As discussed, expose should not be necessary.