add reverse option

This commit is contained in:
Adrien Beudin 2017-07-14 14:54:06 +02:00
parent 4917c51e4a
commit 032a559b3b

View File

@ -514,9 +514,9 @@ def build_index(settings, galleries_cover, templates, gallery_path='', sub_index
reverse = gallery_settings.get('reverse', settings.get('reverse', True)) reverse = gallery_settings.get('reverse', settings.get('reverse', True))
if reverse: if reverse:
galleries_cover = reversed(sorted(filter(lambda x: x != {}, galleries_cover), key=lambda x: x["date"])) galleries_cover = reversed(sorted([x for x in galleries_cover if x != {}], key=lambda x: x["date"]))
else: else:
galleries_cover = sorted(filter(lambda x: x != {}, galleries_cover), key=lambda x: x["date"]) galleries_cover = sorted([x for x in galleries_cover if x != {}], key=lambda x: x["date"])
# this should probably be a factory # this should probably be a factory
Image.base_dir = Path(".").joinpath(gallery_path) Image.base_dir = Path(".").joinpath(gallery_path)