summaryrefslogtreecommitdiff
path: root/service/pixelated/bitmask_libraries
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-08-04 14:28:48 -0300
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:31 +0200
commit5862cb1db30fe4b748427cae663d4f3be3dd7af8 (patch)
tree51d8716052fc3b4227018b562b7d5c8c300624b9 /service/pixelated/bitmask_libraries
parenta7c84d6faf5ddd7866ce4c0508e03c7c3779eaca (diff)
[refactor] Extracts get_key logic, sharing it
This avoids direct access to keymanager and reuses logic from NickNym class. -- Issue #422
Diffstat (limited to 'service/pixelated/bitmask_libraries')
-rw-r--r--service/pixelated/bitmask_libraries/nicknym.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/service/pixelated/bitmask_libraries/nicknym.py b/service/pixelated/bitmask_libraries/nicknym.py
index 810161ee..826ecb58 100644
--- a/service/pixelated/bitmask_libraries/nicknym.py
+++ b/service/pixelated/bitmask_libraries/nicknym.py
@@ -40,11 +40,14 @@ class NickNym(object):
@defer.inlineCallbacks
def _key_exists(self, email):
try:
- yield self.keymanager.get_key(email, openpgp.OpenPGPKey, private=True, fetch_remote=False)
+ yield self.fetch_key(email, private=True, fetch_remote=False)
defer.returnValue(True)
except KeyNotFound:
defer.returnValue(False)
+ def fetch_key(self, email, private=False, fetch_remote=True):
+ return self.keymanager.get_key(email, openpgp.OpenPGPKey, private=private, fetch_remote=fetch_remote)
+
def _gen_key(self):
return self.keymanager.gen_key(openpgp.OpenPGPKey)