changeset 959f612143dd in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=959f612143dd description: close file automaticaly
diffstat:
src/profile_window.py | 4 ++-- src/remote_control.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diffs (28 lines):
diff -r dd57b96138ad -r 959f612143dd src/profile_window.py --- a/src/profile_window.py Thu Jan 03 17:03:40 2013 +0400 +++ b/src/profile_window.py Thu Jan 03 17:09:51 2013 +0400 @@ -154,8 +154,8 @@ scaled_pixbuf.savev(path_to_file, 'png', [], []) must_delete = True
- fd = open(path_to_file, 'rb') - data = fd.read() + with open(path_to_file, 'rb') as fd: + data = fd.read() pixbuf = gtkgui_helpers.get_pixbuf_from_data(data) try: # rescale it diff -r dd57b96138ad -r 959f612143dd src/remote_control.py --- a/src/remote_control.py Thu Jan 03 17:03:40 2013 +0400 +++ b/src/remote_control.py Thu Jan 03 17:09:51 2013 +0400 @@ -905,8 +905,8 @@ else: invalid_file = True if not invalid_file and filesize < 16384: - fd = open(picture, 'rb') - data = fd.read() + with open(picture, 'rb') as fb: + data = fd.read() avatar = base64.b64encode(data).decode('utf-8') avatar_mime_type = mimetypes.guess_type(picture)[0] vcard={}