summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-16 11:17:52 +0100
committerErik Johnston <erik@matrix.org>2015-04-16 11:17:52 +0100
commitb8092fbc82edb3c7d8aa09f0756fa853ad6a6ad8 (patch)
tree57fad9f09c102550fdbad7ac047ec02eb6a24283 /synapse/storage/events.py
parentMove encoding and decoding of JSON into storage layer (diff)
downloadsynapse-b8092fbc82edb3c7d8aa09f0756fa853ad6a6ad8.tar.xz
Go back to storing JSON in TEXT
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 0373d152b2..7dbf7a396a 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -168,7 +168,7 @@ class EventsStore(SQLBaseStore):
 
         metadata_json = encode_canonical_json(
             event.internal_metadata.get_dict()
-        )
+        ).decode("UTF-8")
 
         # If we have already persisted this event, we don't need to do any
         # more processing.
@@ -184,7 +184,7 @@ class EventsStore(SQLBaseStore):
                 )
                 txn.execute(
                     sql,
-                    (buffer(metadata_json), event.event_id,)
+                    (metadata_json, event.event_id,)
                 )
 
                 sql = (
@@ -229,14 +229,14 @@ class EventsStore(SQLBaseStore):
             values={
                 "event_id": event.event_id,
                 "room_id": event.room_id,
-                "internal_metadata": buffer(metadata_json),
-                "json": buffer(encode_canonical_json(event_dict)),
+                "internal_metadata": metadata_json,
+                "json": encode_canonical_json(event_dict).decode("UTF-8"),
             },
         )
 
-        content = buffer(encode_canonical_json(
+        content = encode_canonical_json(
             event.content
-        ))
+        ).decode("UTF-8")
 
         vals = {
             "topological_ordering": event.depth,
@@ -261,9 +261,9 @@ class EventsStore(SQLBaseStore):
             ]
         }
 
-        vals["unrecognized_keys"] = buffer(encode_canonical_json(
+        vals["unrecognized_keys"] = encode_canonical_json(
             unrec
-        ))
+        ).decode("UTF-8")
 
         sql = (
             "INSERT INTO events"