Merge lp:~jcsackett/launchpad/bad-state-transition-641266 into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2010-09-28 |
| 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 | 2010-09-27 | Approve on 2010-09-28 |
|
Review via email:
|
|||
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.
| Aaron Bentley (abentley) wrote : | # |
| j.c.sackett (jcsackett) wrote : | # |
> As discussed, expose should not be necessary.
Expose has been removed. It did require adding a line to the mess that is canonical.
| Graham Binns (gmb) wrote : | # |
> === modified file 'lib/canonical/
> --- lib/canonical/
> +++ lib/canonical/
> @@ -96,6 +96,7 @@
> from canonical.
> from canonical.
> from lp.registry.
> +from lp.registry.errors import TeamMembershipT
> from lp.soyuz.
> from lp.registry.
> from lp.registry.
> === added file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -0,0 +1,20 @@
> +# Copyright 2009 Canonical Ltd. This software is licensed under the
It's 2010. If you want to update standard_template and
standard_
then that's fine with me.
Other than that, r=me.

As discussed, expose should not be necessary.