changeset 0feccf27564d in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=0feccf27564d
description: correctly close file after it's opened
diffstat:
src/common/jingle_xtls.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (19 lines):
diff -r a7dcfb80ff04 -r 0feccf27564d src/common/jingle_xtls.py
--- a/src/common/jingle_xtls.py Sat Jan 05 10:07:10 2013 +0100
+++ b/src/common/jingle_xtls.py Sat Jan 05 10:07:35 2013 +0100
@@ -114,11 +114,11 @@
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)