Sort images before displaying list.
os.listdir returns a file list in inode order, not alphabtical.master
parent
a1e660fc12
commit
c01410344c
|
@ -73,9 +73,9 @@ def send_thumb(tgt):
|
|||
@app.route('/')
|
||||
@app.route('/<path:tgt>')
|
||||
def view(tgt=''):
|
||||
try:
|
||||
try:
|
||||
path = abspath(safe_join(base, tgt))
|
||||
names = map(lambda s: s.decode(app.config['CHARSET']), os.listdir(path))
|
||||
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)
|
||||
return render_template('main.html', dirs=dirs, pics=pics, path=tgt,
|
||||
|
|
Loading…
Reference in New Issue