From 3dff60a56494924993d33c3fa9f53c3fa688bfe1 Mon Sep 17 00:00:00 2001 From: Robert Gerus Date: Wed, 12 Feb 2020 22:39:25 +0100 Subject: [PATCH] Python3-ify by running 2to3 and removing .decode() --- gallery.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gallery.py b/gallery.py index 410b934..5a4e6f3 100644 --- a/gallery.py +++ b/gallery.py @@ -67,7 +67,7 @@ def send_thumb(tgt): sz = image.size scale = min(float(b) / a for a,b in zip(sz, thsize)) scale = min(scale, 1) - image.resize(map(int, (scale * sz[0], scale * sz[1])), Image.ANTIALIAS).save(thumb_path) + image.resize(list(map(int, (scale * sz[0], scale * sz[1]))), Image.ANTIALIAS).save(thumb_path) return send_file(thumb_path) @app.route('/') @@ -75,9 +75,9 @@ def send_thumb(tgt): def view(tgt=''): try: path = abspath(safe_join(base, tgt)) - names = map(lambda s: s.decode(app.config['CHARSET']), sorted(os.listdir(path))) - dirs = filter(lambda f: isdir(safe_join(path,f)), names) - pics = filter(is_image, names) + names = [s for s in sorted(os.listdir(path))] + dirs = [f for f in names if isdir(safe_join(path,f))] + pics = list(filter(is_image, names)) return render_template('main.html', dirs=dirs, pics=pics, path=tgt, parent = '/' + os.path.split(tgt)[0]) except OSError as e: