Make custom field text handling work just like model field handling.
Review Request #6540 — Created Oct. 30, 2014 and submitted
The custom text fields didn't have the same behavior that standard model
fields had. Switching text types without setting new text didn't result
in automatic escaping/unescaping logic, and the proper fields weren't
being read consistently everywhere. The fields also didn't respect the
deprecated text_type= property anymore (whereas they did in previous
releases, before the split fields).We now have logic that mirrors what we do for plain text fields, and
helps normalize the results so that there's always an entry for the text
and an entry for the text type.Unit tests were updated to check custom fields when setting text types.
Unit tests pass.
Tested that I could change the text type field in API requests and the text
would auto-escape/unescape.Tested having the text set to Markdown in extra_data, and just sending new
text in the request. Saw it was auto-escaped.Tested custom fields in the UI.
- Change Summary:
-
- Fixed some warnings.
- Fixed setting just text in a request and having it auto-escaped when the stored type was Markdown.
- Testing Done:
-
Unit tests pass.
Tested that I could change the text type field in API requests and the text
would auto-escape/unescape. + Tested having the text set to Markdown in extra_data, and just sending new
+ text in the request. Saw it was auto-escaped. + Tested custom fields in the UI.
- Commit:
-
e40d6c4c8f4a265d592f9970f9396b485f0efc931cb7913f000ed276cf97d829744cbd5463eb2e5d
-
Tool: Pyflakes Processed Files: reviewboard/reviews/markdown_utils.py reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/mixins.py reviewboard/webapi/tests/test_review_request_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/markdown_utils.py reviewboard/webapi/resources/review_request_draft.py reviewboard/webapi/mixins.py reviewboard/webapi/tests/test_review_request_draft.py