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

View file

@ -114,11 +114,11 @@ def get_context(fingerprint, verify_cb=None):
def send_cert(con, jid_from, sid): def send_cert(con, jid_from, sid):
certpath = os.path.join(gajim.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE) + \ certpath = os.path.join(gajim.MY_CERT_DIR, SELF_SIGNED_CERTIFICATE) + \
'.cert' '.cert'
certfile = open(certpath, 'r')
certificate = '' certificate = ''
for line in certfile.readlines(): with open(certpath, 'r') as certfile:
if not line.startswith('-'): for line in certfile.readlines():
certificate += line if not line.startswith('-'):
certificate += line
iq = nbxmpp.Iq('result', to=jid_from); iq = nbxmpp.Iq('result', to=jid_from);
iq.setAttr('id', sid) iq.setAttr('id', sid)