forked from platypush/platypush
Don't serialize children_ids in Entity.to_json()
Serializing both children_ids and parent_id can result in nasty SQLAlchemy bugs, especially when handling objects that haven't been flushed yet.
This commit is contained in:
parent
f9b6799a18
commit
1c811a490f
1 changed files with 1 additions and 3 deletions
|
@ -112,9 +112,7 @@ if 'entity' not in Base.metadata:
|
||||||
return val
|
return val
|
||||||
|
|
||||||
def to_json(self) -> dict:
|
def to_json(self) -> dict:
|
||||||
obj = {col.key: self._serialize_value(col) for col in self.columns}
|
return {col.key: self._serialize_value(col) for col in self.columns}
|
||||||
obj['children_ids'] = [e.id for e in self.children]
|
|
||||||
return obj
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self)
|
return str(self)
|
||||||
|
|
Loading…
Reference in a new issue