Pull inner function out.

This commit is contained in:
Erik Johnston 2015-04-27 14:37:24 +01:00
parent e701aec2d1
commit 0a016b0525

View file

@ -101,8 +101,23 @@ class Keyring(object):
defer.returnValue(cached[0])
return
download = self.key_downloads.get(server_name)
if download is None:
download = self._get_server_verify_key_impl(server_name, key_ids)
self.key_downloads[server_name] = download
@download.addBoth
def callback(ret):
del self.key_downloads[server_name]
return ret
r = yield create_observer(download)
defer.returnValue(r)
@defer.inlineCallbacks
def fetch_keys():
def _get_server_verify_key_impl(self, server_name, key_ids):
# Try to fetch the key from the remote server.
limiter = yield get_retry_limiter(
@ -176,17 +191,3 @@ class Keyring(object):
return
raise ValueError("No verification key found for given key ids")
download = self.key_downloads.get(server_name)
if download is None:
download = fetch_keys()
self.key_downloads[server_name] = download
@download.addBoth
def callback(ret):
del self.key_downloads[server_name]
return ret
r = yield create_observer(download)
defer.returnValue(r)