# HG changeset patch # User k0s # Date 1261731566 18000 # Node ID 4b8aa9b0a45bb15fe7583db2336324b551d561ae # Parent c5d30bfd032e64c52b9ef09e1370a0ee847853db montage actually does something now diff -r c5d30bfd032e -r 4b8aa9b0a45b montage/formatters.py --- a/montage/formatters.py Tue Dec 15 21:04:17 2009 -0500 +++ b/montage/formatters.py Fri Dec 25 03:59:26 2009 -0500 @@ -1,11 +1,26 @@ +import mimetypes from decoupage.formatters import All -class Montage(All): +class Images(object): + """list of images""" def __init__(self, arg): - # XXX dummy arg - self.match = [ "*.jpg", "*.png", ] - # XXX should really filter on mimetype + if 'x' in arg: + width, height = [ i.strip() for i in arg.split('x', 1) ] + self.width = width or None + self.height = height or None + else: + self.width = self.height = None def __call__(self, request, data): - All.__call__(self, request, data) + data['width'] = self.width + data['height'] = self.height + + # filter out non-images + _files = [] + for f in data['files']: + mimetype = mimetypes.guess_type(f['name'])[0] + if mimetype and mimetype.split('/')[0] == 'image': + _files.append(f) + data['files'] = _files + diff -r c5d30bfd032e -r 4b8aa9b0a45b montage/templates/strip.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/montage/templates/strip.html Fri Dec 25 03:59:26 2009 -0500 @@ -0,0 +1,18 @@ + + + + + + +
+
+ ${image['description']} +
+
+
+ + diff -r c5d30bfd032e -r 4b8aa9b0a45b setup.py --- a/setup.py Tue Dec 15 21:04:17 2009 -0500 +++ b/setup.py Fri Dec 25 03:59:26 2009 -0500 @@ -1,7 +1,7 @@ from setuptools import setup, find_packages import sys, os -version = '0.0' +version = '0.0.1' setup(name='montage', version=version, @@ -20,7 +20,7 @@ install_requires=[ # -*- Extra requirements: -*- 'decoupage', - 'PIL' +# 'PIL' ], dependency_links=[ "http://dist.repoze.org/PIL-1.1.6.tar.gz", @@ -28,6 +28,6 @@ entry_points=""" # -*- Entry points: -*- [decoupage.formatters] - montage = montage.formatters:Montage + images = montage.formatters:Images """, )