← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/bad-state-transition-641266 into lp:launchpad/devel

 

The proposal to merge lp:~jcsackett/launchpad/bad-state-transition-641266 into lp:launchpad/devel has been updated.

Description changed to:

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_teammembership_webservice

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/launchpad/interfaces/__init__.py
  lib/lp/registry/errors.py
  lib/lp/registry/model/teammembership.py
  lib/lp/registry/tests/test_teammembership_webservice.py

./lib/lp/registry/model/teammembership.py
     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.launchpad.interface.__init__; it was touched as part of getting errors registered with webservice. Another branch is in the works to remove registry items (or at least errors) from this file and into lp.registry.
-- 
https://code.launchpad.net/~jcsackett/launchpad/bad-state-transition-641266/+merge/36726
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/bad-state-transition-641266 into lp:launchpad/devel.



References