[Erp5-report] r8009 - /spec/mandriva/2006.0/zope-Photo/
nobody at svn.erp5.org
nobody at svn.erp5.org
Mon Jun 19 17:39:11 CEST 2006
Author: kevin
Date: Mon Jun 19 17:39:10 2006
New Revision: 8009
URL: http://svn.erp5.org?rev=8009&view=rev
Log:
Commit zope-Photo-1.2.3-6mdk spec files and patches
Added:
spec/mandriva/2006.0/zope-Photo/
spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch (with props)
spec/mandriva/2006.0/zope-Photo/zope-Photo.spec (with props)
Added: spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch
URL: http://svn.erp5.org/spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch?rev=8009&view=auto
==============================================================================
--- spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch (added)
+++ spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch Mon Jun 19 17:39:10 2006
@@ -1,0 +1,291 @@
+diff -ru Photo-1.2.3/Photo/ExtPhotoImage.py Photo-1.2.3.patched/Photo/ExtPhotoImage.py
+--- Photo-1.2.3/Photo/ExtPhotoImage.py 2003-04-25 20:25:21.000000000 +0200
++++ Photo-1.2.3.patched/Photo/ExtPhotoImage.py 2005-12-03 21:16:05.000000000 +0100
+@@ -71,7 +71,7 @@
+ return int(now - mtime)
+
+ security.declareProtected('View', 'index_html')
+- def index_html(self, REQUEST, RESPONSE, format=''):
++ def index_html(self, REQUEST, RESPONSE, format='', quality=75, resolution=None):
+ return PhotoImage.inheritedAttribute('index_html')(self, REQUEST=REQUEST)
+
+ def _data(self):
+@@ -82,7 +82,7 @@
+ def _PILdata(self):
+ return self._get_filename(self.filename)
+
+- def _newImage(self, id, file, path, format=''):
++ def _newImage(self, id, file, path, format='', quality=75, resolution=None):
+ img = PhotoImage(id, path=path)
+ img.manage_file_upload(file, self._content_type(format = format))
+ return img
+Seulement dans Photo-1.2.3.patched/Photo: ExtPhotoImage.pyc
+Seulement dans Photo-1.2.3.patched/Photo: ExtPhotoImage.py.rej
+Seulement dans Photo-1.2.3.patched/Photo: __init__.pyc
+Seulement dans Photo-1.2.3.patched/Photo: PhotoFolder.pyc
+diff -ru Photo-1.2.3/Photo/PhotoImage.py Photo-1.2.3.patched/Photo/PhotoImage.py
+--- Photo-1.2.3/Photo/PhotoImage.py 2003-04-25 20:25:21.000000000 +0200
++++ Photo-1.2.3.patched/Photo/PhotoImage.py 2005-12-03 21:16:08.000000000 +0100
+@@ -34,6 +34,7 @@
+ from AccessControl import ClassSecurityInfo
+ from Globals import InitializeClass
+ from OFS.Image import Image
++from OFS.content_types import guess_content_type
+ import time
+
+ class PhotoImage(Image):
+@@ -65,8 +66,8 @@
+ return int(now - mtime)
+
+ security.declareProtected('View', 'index_html')
+- def index_html(self, REQUEST, RESPONSE, format=''):
+- return PhotoImage.inheritedAttribute('index_html')(self, REQUEST=REQUEST)
++ def index_html(self, REQUEST, RESPONSE, format='', quality=75, resolution=None):
++ return PhotoImage.inheritedAttribute('index_html')(self, REQUEST=REQUEST, RESPONSE=RESPONSE)
+
+ def _data(self):
+ return str(self.data)
+@@ -76,7 +77,7 @@
+ def _PILdata(self):
+ return StringIO(str(self.data))
+
+- def _newImage(self, id, file, path, format=''):
++ def _newImage(self, id, file, path, format='', quality=75, resolution=None):
+ return PhotoImage(id, '', file, self._content_type(format = format))
+
+ def _isValid(self):
+Seulement dans Photo-1.2.3.patched/Photo: PhotoImage.pyc
+diff -ru Photo-1.2.3/Photo/Photo.py Photo-1.2.3.patched/Photo/Photo.py
+--- Photo-1.2.3/Photo/Photo.py 2003-04-25 20:25:21.000000000 +0200
++++ Photo-1.2.3.patched/Photo/Photo.py 2005-12-03 21:16:07.000000000 +0100
+@@ -50,6 +50,9 @@
+ except ImportError: pass
+ import time
+
++
++from zLOG import LOG
++
+ defaultdisplays = {'thumbnail': (128,128),
+ 'xsmall': (200,200),
+ 'small': (320,320),
+@@ -137,7 +140,7 @@
+
+ security.declareProtected('View', 'tag')
+ def tag(self, display=None, height=None, width=None, cookie=0,
+- alt=None, css_class=None, format='', **kw):
++ alt=None, css_class=None, format='', quality=75, resolution=None, **kw):
+ """Return HTML img tag."""
+
+ # Get cookie if display is not specified.
+@@ -146,10 +149,10 @@
+
+ # display may be set from a cookie.
+ if display is not None and self._displays.has_key(display):
+- if not self._isGenerated(display,format=format):
++ if not self._isGenerated(display,format=format, quality=quality, resolution=resolution):
+ # Generate photo on-the-fly
+- self._makeDisplayPhoto(display, 1, format=format)
+- image = self._photos[(display,format)]
++ self._makeDisplayPhoto(display, 1, format=format, quality=quality,resolution=resolution)
++ image = self._photos[(display, format, quality,resolution)]
+ width, height = (image._width(), image._height())
+ # Set cookie for chosen size
+ if cookie:
+@@ -192,7 +195,7 @@
+
+ security.declareProtected('View', 'exttag')
+ def exttag(self, prefix, display=None, height=None, width=None, cookie=0,
+- alt=None, css_class=None, format='', **kw):
++ alt=None, css_class=None, format='', quality=75, resolution=None, **kw):
+ """Return HTML img tag for serving outside Zope."""
+
+ # Get cookie if display is not specified.
+@@ -201,10 +204,10 @@
+
+ # display may be set from a cookie.
+ if display is not None and self._displays.has_key(display):
+- if not self._isGenerated(display, format=format):
++ if not self._isGenerated(display, format=format, quality=quality,resolution=resolution):
+ # Generate photo on-the-fly
+- self._makeDisplayPhoto(display, 1, format=format)
+- image = self._photos[(display, format)]
++ self._makeDisplayPhoto(display, 1, format=format, quality=quality,resolution=resolution)
++ image = self._photos[(display, format, quality,resolution)]
+ width, height = (image._width(), image._height())
+ # Set cookie for chosen size
+ if cookie:
+@@ -214,7 +217,7 @@
+ prefix = prefix + '/'
+
+ if display:
+- filename = self._photos[(display, format)].filename
++ filename = self._photos[(display, format, quality,resolution)].filename
+ else:
+ filename = self._original.filename
+
+@@ -276,11 +279,11 @@
+ return links
+
+ security.declareProtected('Access contents information', 'displayMap')
+- def displayMap(self, exclude=None, format=''):
++ def displayMap(self, exclude=None, format='', quality=75, resolution=None):
+ """Return list of displays with size info."""
+ displays = []
+ for id in self.displayIds(exclude):
+- if self._isGenerated(id, format=format):
++ if self._isGenerated(id, format=format, quality=quality,resolution=resolution):
+ photo_width = self._photos[(id,format)]._width()
+ photo_height = self._photos[(id,format)]._height()
+ bytes = self._photos[(id,format)]._size()
+@@ -298,20 +301,21 @@
+ return displays
+
+ security.declareProtected('View', 'index_html')
+- def index_html(self, REQUEST, RESPONSE, display=None, format=''):
++ def index_html(self, REQUEST, RESPONSE, display=None, format='', quality=75, resolution=None):
+ """Return the image data."""
+
+ # display may be set from a cookie (?)
+- if display and self._displays.has_key(display):
+- if not self._isGenerated(display, format=format):
++ if (display is not None or resolution is not None or quality != 75) and self._displays.has_key(display):
++ if not self._isGenerated(display, format=format, quality=quality,resolution=resolution):
+ # Generate photo on-the-fly
+- self._makeDisplayPhoto(display, 1, format=format)
++ self._makeDisplayPhoto(display, 1, format=format, quality=quality,resolution=resolution)
+ else:
+ timeout = self.propertysheets.get('photoconf').getProperty('timeout')
+- if timeout and self._photos[(display,format)]._age() > (timeout / 2):
+- self._expireDisplays((display,), timeout, format=format)
++ if timeout and self._photos[(display,format,quality,resolution)]._age() > (timeout / 2):
++ self._expireDisplays(exclude=[], timeout=timeout, format=format, quality=quality, resolution=resolution)
++ #self._makeDisplayPhoto(display, 1, format=format, quality=quality,resolution=resolution)
+ # Return resized image
+- return self._photos[(display,format)].index_html(REQUEST, RESPONSE, format=format)
++ return self._photos[(display,format,quality,resolution)].index_html(REQUEST, RESPONSE, format=format,quality=quality,resolution=resolution)
+
+ # Return original image
+ return self._original.index_html(REQUEST, RESPONSE)
+@@ -345,7 +349,7 @@
+ # Photo processing
+ #
+
+- def _resize(self, display, width, height, engine='ImageMagick', quality=75, format=''):
++ def _resize(self, display, width, height, engine='ImageMagick', quality=75, format='', resolution=None):
+ """Resize and resample photo."""
+ origimg = self._original
+ newimg = StringIO()
+@@ -359,8 +363,13 @@
+ from win32pipe import popen2
+ from tempfile import mktemp
+ newimg_path = mktemp(suffix=format)
+- imgin, imgout = popen2('convert -quality %s -geometry %sx%s - %s'
++ if resolution is None:
++ imgin, imgout = popen2('convert -quality %s -geometry %sx%s - %s'
+ % (quality, width, height, newimg_path), 'b')
++ else:
++ imgin, imgout = popen2('convert -density %sx%s -quality %s -geometry %sx%s - %s'
++ % (resolution, resolution, quality, width, height, newimg_path), 'b')
++
+ else:
+ from popen2 import popen2
+ import tempfile
+@@ -368,8 +377,13 @@
+ tempfile.tempdir = '/tmp'
+ newimg_path = tempfile.mktemp(suffix='.' + format)
+ tempfile.tempdir = tempdir
+- imgout, imgin = popen2('convert -quality %s -geometry %sx%s - %s'
++ if resolution is None:
++ imgout, imgin = popen2('convert -quality %s -geometry %sx%s - %s'
+ % (quality, width, height, newimg_path))
++ else:
++ LOG('Resolution',0,str(resolution))
++ imgout, imgin = popen2('convert -density %sx%s -quality %s -geometry %sx%s - %s'
++ % (resolution, resolution, quality, width, height, newimg_path))
+ imgin.write(origimg._IMdata())
+ imgin.close()
+ imgout.read()
+@@ -381,7 +395,7 @@
+ newimg.seek(0)
+ return newimg
+
+- def _getDisplayData(self, display, format=''):
++ def _getDisplayData(self, display, format='', quality=None, resolution=None):
+ """Return raw photo data for given display."""
+ (width, height) = self._displays[display]
+ if width == 0 and height == 0:
+@@ -389,10 +403,10 @@
+ height = self._original._height()
+ (width, height) = self._getAspectRatioSize(width, height)
+ engine = self.propertysheets.get('photoconf').getProperty('engine')
+- quality = self.propertysheets.get('photoconf').getProperty('quality')
+- return self._resize(display, width, height, engine, quality, format=format)
++ if quality is None: quality = self.propertysheets.get('photoconf').getProperty('quality')
++ return self._resize(display, width, height, engine, quality, format=format,resolution=resolution)
+
+- def _getDisplayPhoto(self, display, format=''):
++ def _getDisplayPhoto(self, display, format='', quality=75, resolution=None):
+ """Return photo object for given display."""
+ try:
+ base, ext = string.split(self.id, '.')
+@@ -400,17 +414,17 @@
+ except ValueError:
+ id = self.id+'_'+display
+ return self._original._newImage(id, self._getDisplayData(display,
+- format=format), self.absolute_url(1), format=format)
++ format=format, quality=quality,resolution=resolution), self.absolute_url(1), format=format, quality=quality,resolution=resolution)
+
+- def _makeDisplayPhoto(self, display, force=0, format=''):
++ def _makeDisplayPhoto(self, display, force=0, format='', quality=75, resolution=None):
+ """Create given display."""
+- if self._shouldGenerate(display, format=format) or force:
++ if self._shouldGenerate(display, format=format, quality=quality,resolution=resolution) or force:
+ photo = self._photos
+- if photo.has_key((display,format)):
+- photo[(display,format)].manage_upload(self._getDisplayData(display
+- ,format=format), self.content_type(format=format))
++ if photo.has_key((display,format,quality,resolution)):
++ photo[(display, format, quality,resolution)].manage_upload(self._getDisplayData(display
++ ,format=format, quality=quality, resolution=resolution), self.content_type(format=format))
+ else:
+- photo[(display,format)] = self._getDisplayPhoto(display,format=format)
++ photo[(display, format, quality,resolution)] = self._getDisplayPhoto(display,format=format, quality=quality,resolution=resolution)
+ self._photos = photo
+
+ def _makeDisplayPhotos(self):
+@@ -431,16 +445,16 @@
+ """At least see if it *might* be valid."""
+ return self._original._isValid()
+
+- def _isGenerated(self, display, format=''):
++ def _isGenerated(self, display, format='', quality=75, resolution=None):
+ """Return whether display has been generated."""
+- return self._photos.has_key((display, format))
++ return self._photos.has_key((display, format, quality,resolution))
+
+- def _shouldGenerate(self, display, format=''):
++ def _shouldGenerate(self, display, format='', quality=75, resolution=None):
+ """Return whether display should be generated."""
+- return (self._isGenerated(display, format=format) or
++ return (self._isGenerated(display, format=format, quality=quality,resolution=resolution) or
+ self.propertysheets.get('photoconf').getProperty('pregen'))
+
+- def _expireDisplays(self, exclude=[], timeout=None, format=''):
++ def _expireDisplays(self, exclude=[], timeout=None, format='', quality=75, resolution=None):
+ """Remove displays that have expired."""
+
+ if timeout is None:
+@@ -633,6 +647,12 @@
+ if not hasattr(self, '_original'):
+ # Added Photo (vs. imported)
+ # See note in PUT()
++ ## XXX XXXXXXXXXXXXXXXXXXXXXXXXXXX
++ if not hasattr(self, 'properties') :
++ return
++ if self.properties.get('photoconf', None) is None :
++ return
++ ## /XXX added by jerome
+ store = self.propertysheets.get('photoconf').getProperty('store')
+ if store == 'Image': from PhotoImage import PhotoImage
+ elif store == 'ExtImage': from ExtPhotoImage import PhotoImage
+Seulement dans Photo-1.2.3.patched/Photo: Photo.pyc
Propchange: spec/mandriva/2006.0/zope-Photo/Photo-1.2.3-more_options.patch
------------------------------------------------------------------------------
svn:executable = *
Added: spec/mandriva/2006.0/zope-Photo/zope-Photo.spec
URL: http://svn.erp5.org/spec/mandriva/2006.0/zope-Photo/zope-Photo.spec?rev=8009&view=auto
==============================================================================
--- spec/mandriva/2006.0/zope-Photo/zope-Photo.spec (added)
+++ spec/mandriva/2006.0/zope-Photo/zope-Photo.spec Mon Jun 19 17:39:10 2006
@@ -1,0 +1,82 @@
+%define product Photo
+%define version 1.2.3
+%define release 6
+
+%define zope_home %{_prefix}/lib/zope
+%define software_home %{zope_home}/lib/python
+
+Summary: A Zope product to help managing images in Zope
+Name: zope-%{product}
+Version: %{version}
+Release: %mkrel %{release}
+License: GPL
+Group: System/Servers
+URL: http://www.zope.org/Members/rbickers/Photo
+Source0: %{product}-%{version}.tar.bz2
+Patch1: Photo-1.2.3-more_options.patch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rootdir
+BuildArch: noarch
+Requires: zope
+
+#----------------------------------------------------------------------
+%description
+This product provides a Photo object and a Photo Folder object for
+managing digital images in Zope. Photo objects provide multiple
+configurable sizes of the photo. Photo Folders provide a way to manage a
+group of Photo objects by providing a way to specify display sizes and
+properties for all contained photos.
+
+This Zope product is patched to add more options.
+
+#----------------------------------------------------------------------
+%prep
+%setup -c
+%patch1 -p1
+
+%build
+# Not much, eh? :-)
+
+
+%install
+%{__rm} -rf %{buildroot}
+%{__mkdir_p} %{buildroot}/%{software_home}/Products
+%{__cp} -a * %{buildroot}%{software_home}/Products/
+
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%post
+if [ "`%{_prefix}/bin/zopectl status`" != "daemon manager not running" ] ; then
+ service zope restart
+fi
+
+%postun
+if [ -f "%{_prefix}/bin/zopectl" ] && [ "`%{_prefix}/bin/zopectl status`" != "daemon manager not running" ] ; then
+ service zope restart
+fi
+
+%files
+%defattr(0644, root, root, 0755)
+%{software_home}/Products/*
+
+#----------------------------------------------------------------------
+%changelog
+* Wed Jan 5 2006 Kevin Deldycke <kevin at nexedi.com> 1.2.3-6mdk
+- Update spec file to follow Mandriva 2006 rules
+- Update the patch
+
+* Wed Mar 31 2005 Sebastien Robin <seb at nexedi.com> 1.2.3-5mdk
+- Added patch to make a tree of directories with Photo
+
+* Wed Sep 12 2003 Sebastien Robin <seb at nexedi.com> 1.2.3-4mdk
+- Make now signed rpm
+
+* Wed Sep 05 2003 Sebastien Robin <seb at nexedi.com> 1.2.3-3mdk
+- Update spec in order to follows Mandrake Rules
+
+* Wed Apr 25 2003 Sebastien Robin <seb at nexedi.com> 1.2.3-2nxd
+- Clean the spec file
+
+* Mon Feb 3 2003 Jean-Paul Smets <jp at nexedi.com> 1.2.3-1nxd
+- Initial release
Propchange: spec/mandriva/2006.0/zope-Photo/zope-Photo.spec
------------------------------------------------------------------------------
svn:executable = *
More information about the Erp5-report
mailing list