New submission from Damien Baty <damien.b...@gmail.com>:

The "repoze.bitblt" middleware accepts a "quality" parameter. However, with the 
following Paster deploy configuration:

  [app:main]
  use = egg:MyApp#app
  filter-with = bitblt

  [filter:bitblt]
  use = egg:repoze.bitblt#bitblt
  secret = lkjsdflkj0909KJLKJD9908
  quality = 80

I get the following traceback:

  [...]
  File "/Users/damien/dev/repoze.bitblt/repoze/bitblt/processor.py", line 49, 
in 
process
    image.save(f, image.format.upper(), quality=self.quality)
  File "/Users/damien/env-bfg/lib/python2.5/site-packages/PIL/Image.py", line 
1405, in save
    save_handler(self, fp, filename)
  File "/Users/damien/env-bfg/lib/python2.5/site-packages/PIL/
JpegImagePlugin.py", line 409, in _save
    ImageFile._save(im, fp, [("jpeg", (0,0)+im.size, 0, rawmode)])
  File "/Users/damien/env-bfg/lib/python2.5/site-packages/PIL/ImageFile.py", 
line 
473, in _save
    e = Image._getencoder(im.mode, e, a, im.encoderconfig)
  File "/Users/damien/env-bfg/lib/python2.5/site-packages/PIL/Image.py", line 
389, in _getencoder
    return apply(encoder, (mode,) + args + extra)
  TypeError: an integer is required

As far as I know, there is no way in Paste Deploy to indicate that "quality" 
should 
be coerced into an integer. The fix is obvious, cf. attached file.

----------
assignedto: malthe
files: processor.py.patch
messages: 243
nosy: dbaty, malthe
priority: bug
status: unread
title: Unable to configure image quality in Paste Deploy for repoze.bitblt
topic: repoze.bitblt

__________________________________
Repoze Bugs <b...@bugs.repoze.org>
<http://bugs.repoze.org/issue90>
__________________________________
Index: processor.py
===================================================================
--- processor.py	(révision 5653)
+++ processor.py	(copie de travail)
@@ -24,7 +24,7 @@
         if secret is None:
             raise ValueError("Must configure ``secret``.")
 
-        self.quality = quality
+        self.quality = int(quality)
         self.app = app
         self.secret = secret
         self.filter = {
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to