From 46413be2af54618451591b6a5ce3345c44c679ff Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Sat, 3 Feb 2024 05:40:57 -0500 Subject: [PATCH] make sure Item.updated is a datetime object if it isn't one already --- relay/cache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/relay/cache.py b/relay/cache.py index 97aff14..5e6b2ee 100644 --- a/relay/cache.py +++ b/relay/cache.py @@ -69,7 +69,10 @@ class Item: def from_data(cls: type[Item], *args) -> Item: data = cls(*args) data.value = deserialize_value(data.value, data.value_type) - data.updated = datetime.fromtimestamp(data.updated, tz = timezone.utc) + + if not isinstance(data.updated, datetime): + data.updated = datetime.fromtimestamp(data.updated, tz = timezone.utc) + return data