Python3-ify by running 2to3 and removing .decode()
This commit is contained in:
parent
c01410344c
commit
3dff60a564
1 changed files with 4 additions and 4 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue