From 02659358db23afeed729f94e58db018b9dd0cbb4 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Fri, 9 Jan 2009 18:40:01 +0000 Subject: [PATCH] better use of pickle --- src/secrets.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/secrets.py b/src/secrets.py index a09dc717e..94247e606 100644 --- a/src/secrets.py +++ b/src/secrets.py @@ -42,10 +42,8 @@ class Secrets: raise exceptions.Cancelled def save(self): - pickle.dumps(self) - f = open(secrets_filename, 'w') - f.write(pickle.dumps(self)) + pickle.dump(self, f) f.close() def retained_secrets(self, account, bare_jid): @@ -100,7 +98,7 @@ def load_secrets(filename): f = open(filename, 'r') try: - secrets = pickle.loads(f.read()) + secrets = pickle.load(f) except KeyError: f.close() secrets = Secrets(filename)