# HG changeset patch # User k0s # Date 1261787377 18000 # Node ID 8353caad836cc8779226a82f80f812d98854fefd # Parent 73d18f0cf8bb8f8d18cad548620b5bf3562349c8 use a thumbnail if it exists even if its wrong diff -r 73d18f0cf8bb -r 8353caad836c montage/formatters.py --- a/montage/formatters.py Fri Dec 25 19:26:23 2009 -0500 +++ b/montage/formatters.py Fri Dec 25 19:29:37 2009 -0500 @@ -80,18 +80,20 @@ create_thumbnail = True if create_thumbnail: # do thumbnail creation - image = Image.open(filepath) try: + image = Image.open(filepath) thumbnail_image = crop_resize(image, (self.width, self.height)) - except: - continue - fd = file(thumbnail_file, 'w') - thumbnail_image.save(fd) - fd.close() + fd = file(thumbnail_file, 'w') + thumbnail_image.save(fd) + fd.close() + + except: # failure to create thumbnail + pass # fix the path to point to the thumbnail - f['path'] = '%s/%s/%s' % (f['path'].rsplit('/', 1)[0], - self.thumb_dir, - thumbnail) + if os.path.exists(thumbnail_file): + f['path'] = '%s/%s/%s' % (f['path'].rsplit('/', 1)[0], + self.thumb_dir, + thumbnail) diff -r 73d18f0cf8bb -r 8353caad836c setup.py --- a/setup.py Fri Dec 25 19:26:23 2009 -0500 +++ b/setup.py Fri Dec 25 19:29:37 2009 -0500 @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.2.2' +version = '0.2.3' setup(name='montage', version=version,