python: Add a nicer interface to list keys.
* lang/python/pyme/core.py (Context.keylist): New method. * lang/python/tests/t-keylist.py: Test new method. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
4c8265d32d
commit
56e26b54da
@ -468,6 +468,21 @@ class Context(GpgmeWrapper):
|
||||
plainbytes = data.read()
|
||||
return plainbytes, result
|
||||
|
||||
def keylist(self, pattern=None, secret=False):
|
||||
"""List keys
|
||||
|
||||
Keyword arguments:
|
||||
pattern -- return keys matching pattern (default: all keys)
|
||||
secret -- return only secret keys
|
||||
|
||||
Returns:
|
||||
-- an iterator returning key objects
|
||||
|
||||
Raises:
|
||||
GPGMEError -- as signaled by the underlying library
|
||||
"""
|
||||
return self.op_keylist_all(pattern, secret)
|
||||
|
||||
def assuan_transact(self, command,
|
||||
data_cb=None, inquire_cb=None, status_cb=None):
|
||||
"""Issue a raw assuan command
|
||||
|
@ -216,7 +216,7 @@ result = c.op_keylist_result()
|
||||
assert not result.truncated, "Key listing unexpectedly truncated"
|
||||
|
||||
|
||||
for i, key in enumerate(c.op_keylist_all(None, False)):
|
||||
for i, key in enumerate(c.keylist()):
|
||||
try:
|
||||
if len(keys[i]) == 4:
|
||||
fpr, sec_keyid, uids, n_subkeys = keys[i]
|
||||
|
Loading…
Reference in New Issue
Block a user