Python3-ify by running 2to3 and removing .decode()
parent
c01410344c
commit
3dff60a564
|
@ -67,7 +67,7 @@ def send_thumb(tgt):
|
||||||
sz = image.size
|
sz = image.size
|
||||||
scale = min(float(b) / a for a,b in zip(sz, thsize))
|
scale = min(float(b) / a for a,b in zip(sz, thsize))
|
||||||
scale = min(scale, 1)
|
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)
|
return send_file(thumb_path)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
|
@ -75,9 +75,9 @@ def send_thumb(tgt):
|
||||||
def view(tgt=''):
|
def view(tgt=''):
|
||||||
try:
|
try:
|
||||||
path = abspath(safe_join(base, tgt))
|
path = abspath(safe_join(base, tgt))
|
||||||
names = map(lambda s: s.decode(app.config['CHARSET']), sorted(os.listdir(path)))
|
names = [s for s in sorted(os.listdir(path))]
|
||||||
dirs = filter(lambda f: isdir(safe_join(path,f)), names)
|
dirs = [f for f in names if isdir(safe_join(path,f))]
|
||||||
pics = filter(is_image, names)
|
pics = list(filter(is_image, names))
|
||||||
return render_template('main.html', dirs=dirs, pics=pics, path=tgt,
|
return render_template('main.html', dirs=dirs, pics=pics, path=tgt,
|
||||||
parent = '/' + os.path.split(tgt)[0])
|
parent = '/' + os.path.split(tgt)[0])
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
|
Loading…
Reference in New Issue