Skip to content

Commit

Permalink
Fix #2160
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Oct 31, 2015
1 parent cb3ad8a commit 8ef82c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGES.txt
@@ -1,3 +1,11 @@
New in Master
=============

Bugfixes
--------

* Don't examine all gallery image dates every build (Issue #2160)

New in v7.7.3
=============

Expand Down
16 changes: 9 additions & 7 deletions nikola/plugins/task/galleries.py
Expand Up @@ -194,13 +194,6 @@ def gen_tasks(self):
# Create image list, filter exclusions
image_list = self.get_image_list(gallery)

# Sort as needed
# Sort by date
if self.kw['sort_by_date']:
image_list.sort(key=lambda a: self.image_date(a))
else: # Sort by name
image_list.sort()

# Create thumbnails and large images in destination
for image in image_list:
for task in self.create_target_images(image, input_folder):
Expand Down Expand Up @@ -558,6 +551,15 @@ def url_from_path(p):
url = '/'.join(os.path.relpath(p, os.path.dirname(output_name) + os.sep).split(os.sep))
return url

all_data = list(zip(img_list, thumbs, img_titles))

if self.kw['sort_by_date']:
all_data.sort(key=lambda a: self.image_date(a[0]))
else: # Sort by name
all_data.sort(key=lambda a: a[0])

img_list, thumbs, img_titles = zip(*all_data)

photo_array = []
for img, thumb, title in zip(img_list, thumbs, img_titles):
w, h = _image_size_cache.get(thumb, (None, None))
Expand Down

0 comments on commit 8ef82c2

Please sign in to comment.