summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--synapse/handlers/appservice.py2
-rw-r--r--synapse/storage/registration.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py
index 492a630fdc..355ab317df 100644
--- a/synapse/handlers/appservice.py
+++ b/synapse/handlers/appservice.py
@@ -180,7 +180,7 @@ class ApplicationServicesHandler(object):
             return
 
         user_info = yield self.store.get_user_by_id(user_id)
-        if len(user_info) > 0:
+        if not user_info:
             defer.returnValue(False)
             return
 
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 026ba217d6..9351342439 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -112,14 +112,14 @@ class RegistrationStore(SQLBaseStore):
 
     @defer.inlineCallbacks
     def user_delete_access_tokens_apart_from(self, user_id, token_id):
-        rows = yield self.get_user_by_id(user_id)
-        if len(rows) == 0:
+        user = yield self.get_user_by_id(user_id)
+        if not user:
             raise Exception("No such user!")
 
         yield self._execute(
             "delete_access_tokens_apart_from", None,
             "DELETE FROM access_tokens WHERE user_id = ? AND id != ?",
-            rows[0]['id'], token_id
+            user['id'], token_id
         )
 
     @defer.inlineCallbacks