forked from jan/debianmemberportfolio
Add some test code to dump contents of the cache
This commit is contained in:
parent
8ebe8bfede
commit
d12111b400
1 changed files with 23 additions and 0 deletions
|
@ -26,6 +26,7 @@ given keyring.
|
|||
"""
|
||||
import logging
|
||||
import time
|
||||
import sys
|
||||
|
||||
db = None
|
||||
cachetimestamp = 0
|
||||
|
@ -84,3 +85,25 @@ def getLoginByFingerprint(fpr):
|
|||
Gets the login associated with the given fingerprint if available.
|
||||
"""
|
||||
return _get_cached('login:fpr:%s' % fpr)
|
||||
|
||||
def _dump_cache():
|
||||
cache = _get_keyring_cache()
|
||||
fprs = []
|
||||
for key in cache.keys():
|
||||
if key.startswith('email:fpr:'):
|
||||
fpr = key.replace('email:fpr:', '')
|
||||
if not fpr in fprs:
|
||||
fprs.append(fpr)
|
||||
|
||||
for fpr in fprs:
|
||||
login = getLoginByFingerprint(fpr)
|
||||
email = _get_cached('email:fpr:%s' % fpr)
|
||||
name = _get_cached('name:fpr:%s' % fpr)
|
||||
|
||||
print fpr, login, ':'
|
||||
print ' ', name, email
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.basicConfig(stream=sys.stderr, level=logging.WARNING)
|
||||
_dump_cache()
|
||||
|
|
Loading…
Reference in a new issue