Mercurial > libervia-backend
comparison sat/memory/sqla_mapping.py @ 4026:fe4725bf42fb
core (memory/sqla): be sure to have a dict when serialising History.extra:
`extra` can be None, this patch avoid this value when serialising it by using an empty
dict.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 24 Mar 2023 10:29:48 +0100 |
parents | 24c1c06c865b |
children |
comparison
equal
deleted
inserted
replaced
4025:44abce96ac6b | 4026:fe4725bf42fb |
---|---|
271 def __repr__(self): | 271 def __repr__(self): |
272 dt = datetime.fromtimestamp(self.timestamp) | 272 dt = datetime.fromtimestamp(self.timestamp) |
273 return f"History<{self.source_jid.full()}->{self.dest_jid.full()} [{dt}]>" | 273 return f"History<{self.source_jid.full()}->{self.dest_jid.full()} [{dt}]>" |
274 | 274 |
275 def serialise(self): | 275 def serialise(self): |
276 extra = self.extra | 276 extra = self.extra or {} |
277 if self.origin_id is not None: | 277 if self.origin_id is not None: |
278 extra["origin_id"] = self.origin_id | 278 extra["origin_id"] = self.origin_id |
279 if self.stanza_id is not None: | 279 if self.stanza_id is not None: |
280 extra["stanza_id"] = self.stanza_id | 280 extra["stanza_id"] = self.stanza_id |
281 if self.update_uid is not None: | 281 if self.update_uid is not None: |