From 3cd42c9e456f214720e62a17ac36c3cb45d0ac2e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 2 Apr 2023 02:44:19 +0200 Subject: [PATCH] `Entity` should use `Message.Encoder` as a JSON serializer. --- platypush/entities/_base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platypush/entities/_base.py b/platypush/entities/_base.py index 75ce4119b8..7a576600b4 100644 --- a/platypush/entities/_base.py +++ b/platypush/entities/_base.py @@ -22,7 +22,7 @@ from sqlalchemy import ( from sqlalchemy.orm import ColumnProperty, Mapped, backref, relationship from platypush.common.db import Base -from platypush.message import JSONAble +from platypush.message import JSONAble, Message EntityRegistryType = Dict[str, Type['Entity']] entities_registry: EntityRegistryType = {} @@ -183,7 +183,7 @@ if 'entity' not in Base.metadata: """ :return: A JSON-encoded representation of the entity. """ - return json.dumps(self.to_dict()) + return json.dumps(self.to_dict(), cls=Message.Encoder) def __setattr__(self, key, value): """