correctly close file after it's opened

This commit is contained in:
Yann Leboulanger 2013-01-05 10:07:35 +01:00
parent c0a1e9ee88
commit db06bddb81
1 changed files with 4 additions and 4 deletions

View File

@ -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)