From fdc4e33dc3f6c84fe9d7bf9795c603ae3cf5f28d Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 14 Feb 2017 15:56:41 +0100 Subject: [PATCH] python: Add keylist mode parameter. * NEWS: Update. * lang/python/gpg/core.py (Context.keylist): Add 'mode' parameter. Signed-off-by: Justus Winter --- NEWS | 1 + lang/python/gpg/core.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7ec3dfbe..125d54e7 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Noteworthy changes in version 1.8.1 (unreleased) gpgme_data_rewind UN-DEPRECATE. py: Context.__init__ EXTENDED: New keyword argument home_dir. py: Context.home_dir NEW. + py: Context.keylist EXTENDED: New keyword argument mode. Noteworthy changes in version 1.8.0 (2016-11-16) diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py index 79d1f53f..e07ec330 100644 --- a/lang/python/gpg/core.py +++ b/lang/python/gpg/core.py @@ -483,12 +483,14 @@ class Context(GpgmeWrapper): plainbytes = data.read() return plainbytes, result - def keylist(self, pattern=None, secret=False): + def keylist(self, pattern=None, secret=False, + mode=constants.keylist.mode.LOCAL): """List keys Keyword arguments: pattern -- return keys matching pattern (default: all keys) - secret -- return only secret keys + secret -- return only secret keys (default: False) + mode -- keylist mode (default: list local keys) Returns: -- an iterator returning key objects @@ -496,6 +498,7 @@ class Context(GpgmeWrapper): Raises: GPGMEError -- as signaled by the underlying library """ + self.set_keylist_mode(mode) return self.op_keylist_all(pattern, secret) def assuan_transact(self, command,