Merge lp:~sinzui/launchpad/question-title-0 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Edwin Grubbs | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 11500 | ||||
Proposed branch: | lp:~sinzui/launchpad/question-title-0 | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
83 lines (+58/-1) 2 files modified
lib/lp/answers/browser/question.py (+5/-1) lib/lp/answers/browser/tests/test_question.py (+53/-0) |
||||
To merge this branch: | bzr merge lp:~sinzui/launchpad/question-title-0 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edwin Grubbs (community) | code | Approve | |
Review via email: mp+34555@code.launchpad.net |
Description of the change
This is my branch to prevent users from entering long question summaries.
lp:~sinzui/launchpad/question-title-0
Diff size: 84
Launchpad bug:
https:/
Test command: ./bin/test -vv -t TestQuestionAddView
Pre-
Target release: 10.09
Prevent users from entering long question summaries
-------
OOPS-1601O1172 was caused when the user pasted an error log into the title
field. The field should restrict the title to a reasonable
Discovering a reasonable length took some time, looking at question titles
in the db, and at bug titles (because we want bugs to be convertible to
questions). Changing the field definition has a secondary complication--we
would need to update all the existing questions that have titles that are
too long. Since we really want comments to work on way in Launchpad, a
better approach is to ensure the view does not let the user provide too
much information.
Rules
-----
The simplest fix for this issue is to use displayMaxWidth=250 in the
QuestionAddView to tell the browser to ignore characters after 250.
custom_
But in the case where users are posting from a non-lp form (I am speculating)
we can add a constraint to the view to return a field error too. This is also
easier to test than browser compliance.
QA
--
* On staging, as a question with more than 250 characters.
* Verify the page says the question summary cannot exceed 250 characters.
Lint
----
Linting changed files:
lib/lp/
lib/lp/
Test
----
I renamed the existing module to test_views since it it is loading doctests
for question and faq views.
* lib/lp/
* Added tests for the max length of the title field.
Implementation
--------------
* lib/lp/
* Added a validation rule to report an error if the question title is
exceeds 250 characters.
* Added displayMaxWidth to the html element so that users can see that
the excessive content is ignored.
Hi Curtis,
This looks good.
-Edwin