Fix TypeError for number values in settings

In some instances, the backend returns number setting values as an integer rather than a string.

This has been seen in the wild but has been difficult to replicate. The circumstances under which it happens are still unclear. I was able to semi-consistently have a number returned as int from the [Severe Weather Skill](https://github.com/domcross/severe-weather-information-skill) when editing an unrelated setting. To test, remove the 3 character country code (`[A-Z]{3} - `) from the service options of this skill .

This seems to be the quickest fix for it, but worth investigating further from the backend.
pull/2258/head
Kris Gesling 2019-08-17 08:36:00 +09:30 committed by GitHub
parent 5f6db0941b
commit 3cacdaaaab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -489,7 +489,7 @@ class SkillSettings(dict):
value = field.get('value')
if to_platform == 'core':
if "." in value:
if "." in str(value):
sections[i]['fields'][j]['value'] = float(value)
else:
sections[i]['fields'][j]['value'] = int(value)