[pgp] Fix key migration
This commit is contained in:
@@ -50,9 +50,10 @@ class KeyStore:
|
|||||||
def _migrate(self):
|
def _migrate(self):
|
||||||
keys = {}
|
keys = {}
|
||||||
attached_keys = app.config.get_per(
|
attached_keys = app.config.get_per(
|
||||||
'accounts', self._account, 'attached_gpg_keys').split()
|
'accounts', self._account, 'attached_gpg_keys')
|
||||||
if attached_keys is None:
|
if not attached_keys:
|
||||||
return
|
return
|
||||||
|
attached_keys = attached_keys.split()
|
||||||
|
|
||||||
for i in range(len(attached_keys) // 2):
|
for i in range(len(attached_keys) // 2):
|
||||||
keys[attached_keys[2 * i]] = attached_keys[2 * i + 1]
|
keys[attached_keys[2 * i]] = attached_keys[2 * i + 1]
|
||||||
@@ -64,6 +65,9 @@ class KeyStore:
|
|||||||
own_key_user = app.config.get_per('accounts', self._account, 'keyname')
|
own_key_user = app.config.get_per('accounts', self._account, 'keyname')
|
||||||
if own_key_id:
|
if own_key_id:
|
||||||
self.set_own_key_data((own_key_id, own_key_user))
|
self.set_own_key_data((own_key_id, own_key_user))
|
||||||
|
|
||||||
|
attached_keys = app.config.set_per(
|
||||||
|
'accounts', self._account, 'attached_gpg_keys', '')
|
||||||
self._log.info('Migration successful')
|
self._log.info('Migration successful')
|
||||||
|
|
||||||
@delay_execution(500)
|
@delay_execution(500)
|
||||||
|
|||||||
Reference in New Issue
Block a user