From db06bddb814020b881b18a875969085c1e505474 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 5 Jan 2013 10:07:35 +0100 Subject: [PATCH] correctly close file after it's opened --- src/common/jingle_xtls.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/jingle_xtls.py b/src/common/jingle_xtls.py index 02ec551f6..8ceb8dc15 100644 --- a/src/common/jingle_xtls.py +++ b/src/common/jingle_xtls.py @@ -114,11 +114,11 @@ def get_context(fingerprint, verify_cb=None): def send_cert(con, jid_from, sid): certpath = os.path.join(gajim.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE) + \ '.cert' - certfile = open(certpath, 'r') certificate = '' - for line in certfile.readlines(): - if not line.startswith('-'): - certificate += line + with open(certpath, 'r') as certfile: + for line in certfile.readlines(): + if not line.startswith('-'): + certificate += line iq = nbxmpp.Iq('result', to=jid_from); iq.setAttr('id', sid)