Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

fix handling of number fields in jira plugin #73

Merged
merged 2 commits into from
Nov 3, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/sentry_plugins/jira/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,11 @@ def create_issue(self, request, group, form_data, **kwargs):
v = [v]
elif schema.get('custom') == JIRA_CUSTOM_FIELD_TYPES.get('textarea'):
v = v
elif schema['type'] == 'number':
try:
v = int(v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just double check that this number value won't work with floats. If it does, this will truncate them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

except ValueError:
Copy link
Contributor

Choose a reason for hiding this comment

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

This could also raise a TypeError if v were None or some other data structure entirely, so unless you're sure, I'd do except (TypeError, ValueError):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there's a check above for if v:

pass
elif (schema.get('type') != 'string'
or schema.get('items') != 'string'
or schema.get('custom') == JIRA_CUSTOM_FIELD_TYPES.get('select')):
Expand Down