summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-11 17:10:22 +0000
committerErik Johnston <erik@matrix.org>2015-02-11 17:10:22 +0000
commit54fdbc7e50dfdd80eda563536d08bdfef079937c (patch)
tree9d28877f14b914af743629010be54a01477ffddc /synapse/storage/__init__.py
parentAllow newer versions of syutil (diff)
parentBump syutil version (diff)
downloadsynapse-54fdbc7e50dfdd80eda563536d08bdfef079937c.tar.xz
Merge pull request #66 from matrix-org/use-simplejson
Use simplejson
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index a33e2298f6..02b1f06854 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -44,7 +44,6 @@ from syutil.jsonutil import encode_canonical_json
 from synapse.crypto.event_signing import compute_event_reference_hash
 
 
-import json
 import logging
 import os
 
@@ -301,12 +300,16 @@ class DataStore(RoomMemberStore, RoomStore,
             or_replace=True,
         )
 
+        content = encode_canonical_json(
+            event.content
+        ).decode("UTF-8")
+
         vals = {
             "topological_ordering": event.depth,
             "event_id": event.event_id,
             "type": event.type,
             "room_id": event.room_id,
-            "content": json.dumps(event.get_dict()["content"]),
+            "content": content,
             "processed": True,
             "outlier": outlier,
             "depth": event.depth,
@@ -326,7 +329,10 @@ class DataStore(RoomMemberStore, RoomStore,
                 "prev_events",
             ]
         }
-        vals["unrecognized_keys"] = json.dumps(unrec)
+
+        vals["unrecognized_keys"] = encode_canonical_json(
+            unrec
+        ).decode("UTF-8")
 
         try:
             self._simple_insert_txn(