Author: jmorliaguet
Date: Tue Oct  4 14:04:14 2005
New Revision: 27922

Modified:
   z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/filters/effect.py
Log:

- permission fix

- image conversion fix (using PIL drafts to make sure that images are converted
  correctly before saving them)



Modified: 
z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/filters/effect.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/filters/effect.py    
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/browser/renderers/filters/effect.py    
    Tue Oct  4 14:04:14 2005
@@ -25,6 +25,8 @@
 from zope.interface import implements
 from zope.publisher.interfaces import IRequest
 from zope.schema.vocabulary import SimpleVocabulary
+from zope.interface import Interface, providedBy
+from zope.security.proxy import removeSecurityProxy
 
 from cpsskins.model.interfaces import IImage
 from cpsskins.elements.displays.interfaces import IDisplay
@@ -52,6 +54,7 @@
     def __call__(self, data='', info=None, **kw):
         """Apply the filter.
         """
+        data = removeSecurityProxy(data)
         context = self.context
         content = data.content
         element = info.element
@@ -59,7 +62,6 @@
         if not (PILImage and IImage.providedBy(content)):
             return data
 
-
         new_size = (context.width, context.height)
         tmutil = getThemeManager()
         cache = tmutil.getImageCache()
@@ -96,6 +98,8 @@
 
     def _resize(self, im, size):
         new_data = StringIO()
+        im.draft("RGB", im.size)
+        im = im.convert("RGB")
         im.resize(size, PILImage.ANTIALIAS).save(new_data, self.context.format)
         return Image(new_data)
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to