summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-06-13 11:19:18 +0100
committerErik Johnston <erik@matrix.org>2017-06-13 11:19:18 +0100
commit505e7e8b9d51a2529790632799e47a047be1f7d2 (patch)
tree3c46fc6f932be2d4aff41e63d8f6ab9e1c349750 /synapse/storage
parentFix user dir to not assume existence of user (diff)
downloadsynapse-505e7e8b9d51a2529790632799e47a047be1f7d2.tar.xz
Fix up sql
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/user_directory.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/synapse/storage/user_directory.py b/synapse/storage/user_directory.py
index 3f3eee8621..67b14cf26a 100644
--- a/synapse/storage/user_directory.py
+++ b/synapse/storage/user_directory.py
@@ -171,10 +171,12 @@ class UserDirectoryStore(SQLBaseStore):
                             || setweight(to_tsvector('english', COALESCE(?, '')), 'B')
                         )
                     """
-                    args = (
-                        user_id,
-                        get_localpart_from_id(user_id), get_domain_from_id(user_id),
-                        display_name,
+                    txn.execute(
+                        sql,
+                        (
+                            user_id, get_localpart_from_id(user_id),
+                            get_domain_from_id(user_id), display_name,
+                        )
                     )
                 else:
                     sql = """
@@ -184,10 +186,12 @@ class UserDirectoryStore(SQLBaseStore):
                             || setweight(to_tsvector('english', COALESCE(?, '')), 'B')
                         WHERE user_id = ?
                     """
-                    args = (
-                        get_localpart_from_id(user_id), get_domain_from_id(user_id),
-                        display_name,
-                        user_id,
+                    txn.execute(
+                        sql,
+                        (
+                            get_localpart_from_id(user_id), get_domain_from_id(user_id),
+                            display_name, user_id,
+                        )
                     )
             elif isinstance(self.database_engine, Sqlite3Engine):
                 value = "%s %s" % (user_id, display_name,) if display_name else user_id
@@ -202,8 +206,6 @@ class UserDirectoryStore(SQLBaseStore):
                 # This should be unreachable.
                 raise Exception("Unrecognized database engine")
 
-            txn.execute(sql, args)
-
             txn.call_after(self.get_user_in_directory.invalidate, (user_id,))
 
         return self.runInteraction(