make sure Item.updated is a datetime object if it isn't one already
This commit is contained in:
parent
3d81e5ef68
commit
46413be2af
1 changed files with 4 additions and 1 deletions
|
@ -69,7 +69,10 @@ class Item:
|
||||||
def from_data(cls: type[Item], *args) -> Item:
|
def from_data(cls: type[Item], *args) -> Item:
|
||||||
data = cls(*args)
|
data = cls(*args)
|
||||||
data.value = deserialize_value(data.value, data.value_type)
|
data.value = deserialize_value(data.value, data.value_type)
|
||||||
|
|
||||||
|
if not isinstance(data.updated, datetime):
|
||||||
data.updated = datetime.fromtimestamp(data.updated, tz = timezone.utc)
|
data.updated = datetime.fromtimestamp(data.updated, tz = timezone.utc)
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue