[gnome-keysign: 2/8] gpgmeh: Only import via DBus if no homedir was set




commit 869d2e7b4b2b363aa7e2b8bef1565a5bb1bc68ce
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Mon Jun 15 09:32:45 2020 +0200

    gpgmeh: Only import via DBus if no homedir was set
    
    The homedir is a GnuPG concept that is not exposed via Seahorse's API.
    If the users wants to make use of that, we fall through to gpgme. We
    might as well not offer a homedir at all to nudge the consumer into
    making use of the gpgme API directly.

 keysign/gpgmeh.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/keysign/gpgmeh.py b/keysign/gpgmeh.py
index a74d253..5ba1e05 100755
--- a/keysign/gpgmeh.py
+++ b/keysign/gpgmeh.py
@@ -587,11 +587,13 @@ def import_signature(signature, homedir=None):
     if that failed, resort to using gpgme directly.
     """
     result = []
-    try:
-        # Try Seahorse DBus
-        result = import_signature_dbus(signature)
-    except dbus.exceptions.DBusException:
-        log.debug("Seahorse DBus is not available")
+    if not homedir:
+        # If a homedir is requested, we have to use the gpgme API, because we cannot specify a GnuPG keyring 
via DBus
+        try:
+            # Try Seahorse DBus
+            result = import_signature_dbus(signature)
+        except dbus.exceptions.DBusException:
+            log.debug("Seahorse DBus is not available")
 
     # If Seahorse failed we try op_import
     if len(result) < 1:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]