Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Avoid exception when parsing arrays in raw data #1904

Merged
merged 1 commit into from Jun 16, 2022

Conversation

jwalgran
Copy link
Contributor

@jwalgran jwalgran commented Jun 14, 2022

Overview

When submitting a facility via the API the raw data for fields like product_type can contain an array value. Attempting to call fload() on a list was raiding a TypeError rather than a ValueError, resulting in an unhandled exception in the try_parse_int_from_float helper.

Connects #1903

Testing Instructions

This assumes you have run ./scripts/resetdb

{
"name":"1v1 Fight Gear",
"address": "5320 Tower Way, Sanford, 32773, Florida ",
"country":"us",
"product_type": ["api a", "api b"]
}
  • Browse http://localhost:6543/settings, selected the embed tab, and check the "100%" box to get the preview to display
  • In the embed iframe, view the details of the "1v1 Fight Gear" facility
  • Verify that an exception is raised
  • Checkout this branch
  • Refresh them embed and verify that the exception is resolved

Checklist

  • fixup! commits have been squashed
  • CI passes after rebase
  • CHANGELOG.md updated with summary of features or fixes, following Keep a Changelog guidelines
  • This PR is targeted at the correct branch (develop vs. ogr/develop)
  • If this PR applies to both OAR and OGR a companion PR has been created

@jwalgran jwalgran added the task 47 Q2 2022 bugs, support, maintenance label Jun 14, 2022
@jwalgran jwalgran requested a review from TaiWilkin June 14, 2022 17:33
Copy link
Contributor

@TaiWilkin TaiWilkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well. Good to go.

@TaiWilkin TaiWilkin assigned jwalgran and unassigned TaiWilkin Jun 14, 2022
When submitting a facility via the API the raw data for fields like
`product_type` can contain an array value. Attempting to call `fload()` on a
list was raiding a `TypeError` rather than a `ValueError`, resulting in an
unhandled exception in the `try_parse_int_from_float` helper.
@jwalgran
Copy link
Contributor Author

Thanks for the review.

@jwalgran jwalgran merged commit cf827be into develop Jun 16, 2022
@jwalgran jwalgran deleted the bugfix/jcw/embed-array-parsing branch September 20, 2022 19:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
task 47 Q2 2022 bugs, support, maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants