Merge lp:~sinzui/launchpad/sane-definition-status-0 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Robert Collins |
Approved revision: | no longer in the source branch. |
Merged at revision: | 12514 |
Proposed branch: | lp:~sinzui/launchpad/sane-definition-status-0 |
Merge into: | lp:launchpad |
Diff against target: |
296 lines (+104/-13) 8 files modified
lib/lp/blueprints/enums.py (+18/-0) lib/lp/blueprints/interfaces/specification.py (+15/-2) lib/lp/blueprints/model/specification.py (+12/-0) lib/lp/blueprints/tests/test_hasspecifications.py (+1/-3) lib/lp/blueprints/tests/test_specification.py (+43/-1) lib/lp/blueprints/tests/test_webservice.py (+1/-3) lib/lp/code/model/tests/test_branch.py (+2/-2) lib/lp/testing/factory.py (+12/-2) |
To merge this branch: | bzr merge lp:~sinzui/launchpad/sane-definition-status-0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Review via email: mp+51932@code.launchpad.net |
Description of the change
Do not allow closed definition status when creating a specification.
Launchpad bug: https:/
Pre-
Test command: ./bin/test -vv -m lp.blueprints
DB constraint triggered adding a new blueprint with status obsolete or
superseded: IntegrityError ERROR: new row for relation "specification"
violates check constraint "specification_
You cannot create a obsolete or superseded specification because the
form does not capture the all the status and people to actually set the
specification to a closed statues. Users should not be creating closed
specifications. This issue can also happen over API.
-------
RULES
* Create an enum that does not contain obsolete or superseded
definition status.
* Update INewSpecification to use it.
* ADDENDUM: copy the original definition_status to ISpecification to
preserve the rules for life cycle events.
* Add an adaption block to new() to convert the new enum to the life
cycle enum.
* This is because The two enum items are not equivalent, not through
inheritance or via use_template.
* As with branches, use the name of the item to adapt.
* I discussed this design issue with Tim. We may solve this issue in
lazr.enum and Lp's storm enumcol, but that is a separate issue.
QA
* Visit https:/
* Verify that obsolete or superseded are not in the definition
status field.
* Create a blueprint with any status.
* Change it's definition status to obsolete
LINT
lib/
lib/
lib/
lib/
lib/
lib/
lib/
lib/
IMPLEMENTATION
Added a new enum using the original as a template. Updated the interface
to use the enum. Updated ISpecificationS
the enum used by lifecycle events.
lib/
lib/
lib/
lib/
lib/
Updated tests to import the enums form the true location.
lib/
lib/
Updated the factory to work with the life cycle rules.
lib/