Use JSON instead of msgpack

erikj/paginate_sync
Erik Johnston 2016-06-27 13:18:04 +01:00
parent 92c58932d1
commit 4c67e06dfb
1 changed files with 3 additions and 3 deletions

View File

@ -18,7 +18,7 @@ from synapse.api.errors import SynapseError
from collections import namedtuple
from unpaddedbase64 import encode_base64, decode_base64
import msgpack
import ujson as serializer
Requester = namedtuple("Requester", ["user", "access_token_id", "is_guest"])
@ -127,7 +127,7 @@ class SyncNextBatchToken(
@classmethod
def from_string(cls, string):
try:
d = msgpack.loads(decode_base64(string))
d = serializer.loads(decode_base64(string))
pa = d.get("pa", None)
if pa:
pa = SyncPaginationState.from_dict(pa)
@ -139,7 +139,7 @@ class SyncNextBatchToken(
raise SynapseError(400, "Invalid Token")
def to_string(self):
return encode_base64(msgpack.dumps({
return encode_base64(serializer.dumps({
"t": self.stream_token.to_arr(),
"pa": self.pagination_state.to_dict() if self.pagination_state else None,
}))