Fix importing of floating point values in extra_data as string.
Review Request #8250 — Created June 18, 2016 and submitted
import_extra_data()has special handling for converting string representations
of Boolean and integer values inextra_datato their respective data types,
but lacks handling for floating point values. This trickles up so that JSON
responses to API queries show floating point values as strings rather than
numeric values. This issue is fixed by adding special handling for floating
point data types.JSON snippets of a response to a review request draft update are attached to
illustrate the before and after behavior. Notice the floating point fields
are quoted (e.g. represented as strings) in the before case.
- Added a new unit test which failed prior to this fix.
- Ran unit tests.
| Description | From | Last Updated |
|---|---|---|
|
Can we re-format this as: try: value = int(value) except ValueError: try: value = float(value) except ValueError: pass IMO, this … |
|
- Change Summary:
-
Reformat exception handling logic.
- Commit:
-
bde4732afc3b9ce3f79a067dd12dbc6bacc306b78d61b39ad48d3418686cbec243ddbc04480faa91
Tool: Pyflakes Processed Files: reviewboard/webapi/base.py reviewboard/webapi/tests/test_review_request_draft.py Tool: PEP8 Style Checker Processed Files: reviewboard/webapi/base.py reviewboard/webapi/tests/test_review_request_draft.py