From 0231f2aeaa71ebb5490daf3c9b5727b2647dcb78 Mon Sep 17 00:00:00 2001 From: Jeff Santner Date: Wed, 13 Jun 2018 18:19:02 -0700 Subject: [PATCH] Only apply to celsius and fahrenheit --- pyked/validation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pyked/validation.py b/pyked/validation.py index bb94b6d..e198ca2 100644 --- a/pyked/validation.py +++ b/pyked/validation.py @@ -275,8 +275,11 @@ def _validate_isvalid_quantity(self, isvalid_quantity, field, value): """ if type(value[0]) is str: values = value[0].split() - value_alt = [float(values[0])] + values[1:] - quantity = Q_(*value_alt) + if temp in values for temp in ['degC', 'degF', 'celsius', 'fahrenheit']: + value_alt = [float(values[0])] + values[1:] + quantity = Q_(*value_alt) + else: + quantity = Q_(value[0]) else: quantity = Q_(value[0]) low_lim = 0.0 * units(property_units[field])