Set gpg.temp_[key|sec]ring to None after setting key.[key|sec]ring.

* Change the returned _parsers.GenKey from gnupg.GPG.gen_key() to store the
   location of the renamed temporary keyrings as attributes. This way, one can
   do something like:

   >>> key = gpg.gen_key(key_input)
   >>> key.keyring
   './generated-keys/328A5C6C1B2F0891125ECBE4624276B5A2296478.pubring.gpg'
testing/mmn/mktime_takes_localtime_not_gmtime
Isis Lovecruft 2013-06-28 07:09:35 +00:00
parent 8232f14f2a
commit f11ea6901c
No known key found for this signature in database
GPG Key ID: A3ADB67A2CDB8B35
1 changed files with 5 additions and 2 deletions

View File

@ -505,15 +505,18 @@ class GPG(GPGBase):
if os.path.isfile(self.temp_keyring):
try: os.rename(self.temp_keyring, prefix+".pubring")
except OSError as ose: log.error(ose.message)
else: self.temp_keyring = None
if self.temp_secring:
if os.path.isfile(self.temp_secring):
try: os.rename(self.temp_secring, prefix+".secring")
except OSError as ose: log.error(ose.message)
else: self.temp_secring = None
log.info("Key created. Fingerprint: %s" % fpr)
key.keyring = self.temp_keyring
key.secring = self.temp_secring
self.temp_keyring = None
self.temp_secring = None
return key
def gen_key_input(self, separate_keyring=False, save_batchfile=False,