Convert the value in proper format, as we may only get string values

for integer and numeric type.
pull/3/head
Ashesh Vashi 2016-03-24 14:29:44 +05:30
parent 242d5f47f6
commit 067c269fc8
1 changed files with 2 additions and 0 deletions

View File

@ -146,9 +146,11 @@ class _Preference(object):
if type(value) != bool:
return False, gettext("Invalid value for boolean type!")
elif self._type == 'integer':
value = int(value)
if type(value) != int:
return False, gettext("Invalid value for integer type!")
elif self._type == 'numeric':
value = float(value)
t = type(value)
if t != float and t != int and t != decimal.Decimal:
return False, gettext("Invalid value for numeric type!")