Commit 4d089f62 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

fix loading secret files that have been created with gajim <= 0.16.1. Fixes #8114

parent af88260a
......@@ -31,7 +31,7 @@
secrets_filename = gajimpaths['SECRETS_FILE']
secrets_cache = None
class Secrets(object):
class Secrets():
def __init__(self, filename):
self.filename = filename
self.srs = {}
......@@ -95,13 +95,23 @@ def my_pubkey(self, account):
return pk
def load_secrets(filename):
f = open(filename, 'r')
global Secrets
f = open(filename, 'rb')
try:
secrets = pickle.load(f)
except (KeyError, EOFError):
f.close()
secrets = Secrets(filename)
except (AttributeError, TypeError):
class Secrets(object, Secrets):
pass
try:
f.seek(0)
secrets = pickle.load(f)
except (KeyError, EOFError):
f.close()
secrets = Secrets(filename)
return secrets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment