aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-07-28 08:59:46 +0000
committerJustus Winter <[email protected]>2016-07-28 08:59:46 +0000
commit78f7bf4dcf75206faae5776c2ee4166628313532 (patch)
treef54ffe5b6acfec71fbcd005292ce0ee3796891df /lang/python
parentpython: Expose less functions to the Python world. (diff)
downloadgpgme-78f7bf4dcf75206faae5776c2ee4166628313532.tar.gz
gpgme-78f7bf4dcf75206faae5776c2ee4166628313532.zip
python: Add accessors for the protocol.
* lang/python/pyme/core.py (Context.__init__): Add 'protocol' parameter. (Context.protocol): New accessors. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to '')
-rw-r--r--lang/python/pyme/core.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py
index 6ca8cb82..3ca47473 100644
--- a/lang/python/pyme/core.py
+++ b/lang/python/pyme/core.py
@@ -169,6 +169,7 @@ class Context(GpgmeWrapper):
def __init__(self, armor=False, textmode=False, offline=False,
signers=[], pinentry_mode=constants.PINENTRY_MODE_DEFAULT,
+ protocol=constants.PROTOCOL_OpenPGP,
wrapped=None):
"""Construct a context object
@@ -178,6 +179,7 @@ class Context(GpgmeWrapper):
offline -- do not contact external key sources (default False)
signers -- list of keys used for signing (default [])
pinentry_mode -- pinentry mode (default PINENTRY_MODE_DEFAULT)
+ protocol -- protocol to use (default PROTOCOL_OpenPGP)
"""
if wrapped:
@@ -194,6 +196,7 @@ class Context(GpgmeWrapper):
self.offline = offline
self.signers = signers
self.pinentry_mode = pinentry_mode
+ self.protocol = protocol
def encrypt(self, plaintext, recipients=[], sign=True, sink=None,
passphrase=None, always_trust=False, add_encrypt_to=False,
@@ -487,6 +490,14 @@ class Context(GpgmeWrapper):
def pinentry_mode(self, value):
self.set_pinentry_mode(value)
+ @property
+ def protocol(self):
+ """Protocol to use"""
+ return self.get_protocol()
+ @protocol.setter
+ def protocol(self, value):
+ self.set_protocol(value)
+
_ctype = 'gpgme_ctx_t'
_cprefix = 'gpgme_'