diff options
author | drebs <drebs@leap.se> | 2013-04-19 12:47:22 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-04-19 12:47:22 -0300 |
commit | 32999ef8d08b6e94d356ea5fbce43ceebbf5247c (patch) | |
tree | 2a2b44d13bc159fef55adc446e1cfe4d949d9216 /src | |
parent | 314bc876d564cd6265cc8eb4095e423f1140349a (diff) |
Make the key wrapper map an object property.
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/common/keymanager/__init__.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/leap/common/keymanager/__init__.py b/src/leap/common/keymanager/__init__.py index 10acb36..8296b92 100644 --- a/src/leap/common/keymanager/__init__.py +++ b/src/leap/common/keymanager/__init__.py @@ -40,11 +40,6 @@ from leap.common.keymanager.openpgp import ( ) -wrapper_map = { - OpenPGPKey: OpenPGPWrapper(), -} - - class KeyManager(object): def __init__(self, address, url): @@ -59,6 +54,9 @@ class KeyManager(object): """ self.address = address self.url = url + self.wrapper_map = { + OpenPGPKey: OpenPGPWrapper(), + } def send_key(self, ktype, send_private=False, password=None): """ @@ -99,13 +97,13 @@ class KeyManager(object): keyserver. """ try: - return wrapper_map[ktype].get_key(address) + return self.wrapper_map[ktype].get_key(address) except KeyNotFound: key = filter(lambda k: isinstance(k, ktype), self._fetch_keys(address)) if key is None: raise KeyNotFound() - wrapper_map[ktype].put_key(key) + self.wrapper_map[ktype].put_key(key) return key @@ -137,4 +135,4 @@ class KeyManager(object): @return: The generated key. @rtype: EncryptionKey """ - return wrapper_map[ktype].gen_key(self.address) + return self.wrapper_map[ktype].gen_key(self.address) |