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

Conversation

macqueen
Copy link
Contributor

@macqueen macqueen commented Nov 2, 2016

@getsentry/plugins

@macqueen
Copy link
Contributor Author

macqueen commented Nov 2, 2016

fixes getsentry/sentry-jira#108 in this repo

elif schema['type'] == 'number':
try:
v = int(v)
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:

@@ -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.

👍

Copy link
Contributor

@mattrobenolt mattrobenolt left a comment

Choose a reason for hiding this comment

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

:rage1: :rage2: :rage3: :rage4:

@macqueen macqueen merged commit f2d2ee8 into master Nov 3, 2016
@macqueen macqueen deleted the jira-numbers branch November 3, 2016 00:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants