diff options
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/appservice/api.py | 4 | ||||
-rw-r--r-- | synapse/handlers/appservice.py | 22 |
2 files changed, 10 insertions, 16 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py index 4ccb5c43c1..d4cad1b1ed 100644 --- a/synapse/appservice/api.py +++ b/synapse/appservice/api.py @@ -73,7 +73,7 @@ class ApplicationServiceApi(SimpleHttpClient): @defer.inlineCallbacks def query_3pu(self, service, protocol, fields): - uri = service.url + ("/3pu/%s" % urllib.quote(protocol)) + uri = "%s/3pu/%s" % (service.url, urllib.quote(protocol)) response = None try: response = yield self.get_json(uri, fields) @@ -84,7 +84,7 @@ class ApplicationServiceApi(SimpleHttpClient): @defer.inlineCallbacks def query_3pl(self, service, protocol, fields): - uri = service.url + ("/3pl/%s" % urllib.quote(protocol)) + uri = "%s/3pl/%s" % (service.url, urllib.quote(protocol)) response = None try: response = yield self.get_json(uri, fields) diff --git a/synapse/handlers/appservice.py b/synapse/handlers/appservice.py index a2715e5cf6..03452f6bb0 100644 --- a/synapse/handlers/appservice.py +++ b/synapse/handlers/appservice.py @@ -172,13 +172,10 @@ class ApplicationServicesHandler(object): def query_3pu(self, protocol, fields): services = yield self._get_services_for_3pn(protocol) - deferreds = [] - for service in services: - deferreds.append(self.appservice_api.query_3pu( - service, protocol, fields - )) - - results = yield defer.DeferredList(deferreds, consumeErrors=True) + results = yield defer.DeferredList([ + self.appservice_api.query_3pu(service, protocol, fields) + for service in services + ], consumeErrors=True) ret = [] for (success, result) in results: @@ -199,13 +196,10 @@ class ApplicationServicesHandler(object): def query_3pl(self, protocol, fields): services = yield self._get_services_for_3pn(protocol) - deferreds = [] - for service in services: - deferreds.append(self.appservice_api.query_3pl( - service, protocol, fields - )) - - results = yield defer.DeferredList(deferreds, consumeErrors=True) + results = yield defer.DeferredList([ + self.appservice_api.query_3pl(service, protocol, fields) + for service in services + ], consumeErrors=True) ret = [] for (success, result) in results: |