bytes can not be serialized to json

This commit is contained in:
j 2014-10-31 15:51:42 +01:00
parent 5cd43be8c4
commit 38a0431fe0
1 changed files with 4 additions and 1 deletions

View File

@ -126,7 +126,10 @@ class Changelog(db.Model):
def json(self):
timestamp = self.timestamp or datetime2ts(self.created)
return [self.revision, timestamp, self.sig, self.data]
sig = self.sig
if isinstance(sig, bytes):
sig = sig.decode()
return [self.revision, timestamp, sig, self.data]
@classmethod
def restore(cls, user_id, path=None):