Merge lp:~sinzui/launchpad/noneable-bug-475433 into lp:launchpad/db-devel
Proposed by
Curtis Hovey
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | not available | ||||
Proposed branch: | lp:~sinzui/launchpad/noneable-bug-475433 | ||||
Merge into: | lp:launchpad/db-devel | ||||
Diff against target: |
68 lines (+32/-6) 2 files modified
lib/canonical/launchpad/doc/stripped-text-widget.txt (+29/-4) lib/canonical/launchpad/fields/__init__.py (+3/-2) |
||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/noneable-bug-475433 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Francis J. Lacoste (community) | release-critical | Approve | |
Barry Warsaw (community) | code | Approve | |
Review via email: mp+14487@code.launchpad.net |
To post a comment you must log in.
This is my branch to fix the StrippedTextLine field to handle None for
non-required attributes.
lp:~sinzui/launchpad/noneable-bug-475433 /bugs.launchpad .net/bugs/ 475433 text-widget" implementation: no one
Diff size: 69
Launchpad bug: https:/
Test command: ./bin/test -vvt "stripped-
Pre-
Target release: 3.1.10
= Fix the StrippedTextLine field from oopsing =
The OOPS-1405ED465 oops shows the StrippedTextLine is working with None, but
it assumes it has a string.
* Module canonical. launchpad. fields, line 206, in set StrippedTextLin e, self).set(object, value.strip())
super(
AttributeError: 'NoneType' object has no attribute 'strip'
The milestone code_name is optional. but is effectively required to avoid
the oops.
The StrippedTextLin e.set() method was added to by Tim's 2009-10-2 commit- message branch to support API operations, but unlike set(), it does not check if the value is None.
bmp-inline-
its counterpart StrippableText.
== Rules ==
* StrippedTextLine should test for None before calling strip().
== QA ==
* Visit a milestone you can edit
* Set the code name field to empty and submit
* Verify there is no oops and that the value is not set on the page.
== Lint ==
Linting changed files: /launchpad/ doc/stripped- text-widget. txt /launchpad/ fields/ __init_ _.py
lib/canonical
lib/canonical
== Test ==
* lib/canonical/ launchpad/ doc/stripped- text-widget. txt
* Added a test to verify that the StrippedTextLine strips text and
can handle None.
== Implementation ==
* lib/canonical/ launchpad/ fields/ __init_ _.py
* Added a guard before calling strip() on the supposed string.
This is the same approach used by StrippableText for large text.