okay, i agree this is cleaner

master
Tomek Dubrownik 2013-02-21 12:04:00 +01:00
parent 48567e9432
commit a1c1f24087
1 changed files with 2 additions and 2 deletions

View File

@ -49,8 +49,9 @@ def send_thumb(tgt):
image.resize(map(int, (scale * sz[0], scale * sz[1])), Image.ANTIALIAS).save(thumb_path)
return send_file(thumb_path)
@app.route('/')
@app.route('/<path:tgt>')
def view(tgt):
def view(tgt=''):
try:
path = abspath(safe_join(base, tgt))
names = map(lambda s: s.decode(app.config['CHARSET']), os.listdir(path))
@ -61,7 +62,6 @@ def view(tgt):
if e.errno == 2:
abort(404)
app.route('/')(lambda: view(''))
if __name__ == '__main__':
app.run('::', 8080, debug=True)