Pull inner function out.
This commit is contained in:
parent
e701aec2d1
commit
0a016b0525
|
@ -101,8 +101,23 @@ class Keyring(object):
|
||||||
defer.returnValue(cached[0])
|
defer.returnValue(cached[0])
|
||||||
return
|
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
|
@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.
|
# Try to fetch the key from the remote server.
|
||||||
|
|
||||||
limiter = yield get_retry_limiter(
|
limiter = yield get_retry_limiter(
|
||||||
|
@ -176,17 +191,3 @@ class Keyring(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
raise ValueError("No verification key found for given key ids")
|
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)
|
|
||||||
|
|
Loading…
Reference in New Issue