summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-01-27 17:15:06 +0000
committerKegan Dougal <kegan@matrix.org>2015-01-27 17:15:06 +0000
commitec3719b583c6fbbc56dbd313b858054e535ae733 (patch)
tree69aaad6a1f6fe12edfd5129b44085fc95e128853 /synapse/storage
parentAdd stub methods, TODOs and docstrings for application services. (diff)
downloadsynapse-ec3719b583c6fbbc56dbd313b858054e535ae733.tar.xz
Use ApplicationService when registering.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/appservice.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/synapse/storage/appservice.py b/synapse/storage/appservice.py
index fbad17cb9e..f84f026b7b 100644
--- a/synapse/storage/appservice.py
+++ b/synapse/storage/appservice.py
@@ -116,8 +116,7 @@ class ApplicationServiceStore(SQLBaseStore):
     def get_services_for_event(self, event):
         return self.cache.get_services_for_event(event)
 
-    @defer.inlineCallbacks
-    def get_app_service(self, as_token, from_cache=True):
+    def get_app_service(self, token, from_cache=True):
         """Get the application service with the given token.
 
         Args:
@@ -130,21 +129,18 @@ class ApplicationServiceStore(SQLBaseStore):
 
         if from_cache:
             for service in self.cache.services:
-                if service.token == as_token:
-                    defer.returnValue(service)
-                    return
-            defer.returnValue(None)
-            return
-
+                if service.token == token:
+                    return service
+            return None
 
         # TODO: This should be JOINed with the application_services_regex table.
         row = self._simple_select_one(
-            "application_services", {"token": as_token},
+            "application_services", {"token": token},
             ["url", "token"]
         )
         if not row:
             raise StoreError(400, "Bad application services token supplied.")
-        defer.returnValue(row)
+        return row
 
     def _populate_cache(self):
         """Populates the ApplicationServiceCache from the database."""