temp fix for IS_DATETIME with timezone info & record versioning causes TypeError: can't compare offset-naive and offset-aware datetimes #1094

This commit is contained in:
mdipierro
2015-12-04 11:31:55 -06:00
parent dfd6d52192
commit d2910327c0
+2 -1
View File
@@ -2247,7 +2247,8 @@ class IS_DATETIME(Validator):
time.strptime(value, str(self.format))
value = datetime.datetime(y, m, d, hh, mm, ss)
if self.timezone is not None:
value = self.timezone.localize(value).astimezone(utc)
# TODO: https://github.com/web2py/web2py/issues/1094 (temporary solution)
value = self.timezone.localize(value).astimezone(utc).replace(tzinfo=None)
return (value, None)
except:
self.extremes.update(IS_DATETIME.nice(self.format))