Merge lp:~jcsackett/launchpad/bug-nick-validator into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Robert Collins | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12501 | ||||
Proposed branch: | lp:~jcsackett/launchpad/bug-nick-validator | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~jcsackett/launchpad/move-validators | ||||
Diff against target: |
146 lines (+61/-6) 3 files modified
lib/lp/app/validators/name.py (+24/-0) lib/lp/bugs/interfaces/bug.py (+4/-4) lib/lp/bugs/tests/test_bugs_webservice.py (+33/-2) |
||||
To merge this branch: | bzr merge lp:~jcsackett/launchpad/bug-nick-validator | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Review via email: mp+51033@code.launchpad.net |
Commit message
[r=lifeless][bug=192135] Puts a more restrictive validator on bug name to match database constraints, to prevent oopses over the webservice.
Description of the change
Summary
=======
Bug name, while not available in the web ui, can still be accessed and changed via the webservice. The validator being used for it is more permissive than the validation code used in the database, so nicks like '1.1' trigger IntegrityErrors.
This creates a new validator that matches the database constraint, and updates the bug interface to use that.
Implementation
==============
lib/lp/
-------
A new validator, bug_name_validator was created, incorporating the rules used in the database constraint.
lib/lp/
-------
The name attribute is changed to use bug_name_validator as its validator.
Tests
=====
bin/test -vvct TestBugConstraints
Demo & QA
=========
Change a bug's name to '1.1' or similar over the webservice; it will throw back an HTTPError rather than failing. Changing to something starting with a letter will be fine.
Lint
====
make lint output:
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
./lib/lp/
445: E301 expected 1 blank line, found 0
1177: E301 expected 1 blank line, found 2