[Checkins] SVN: z3c.image/trunk/ do not rely on private attributes
in the context
Juergen Kartnaller
juergen at kartnaller.at
Thu Jan 17 07:47:15 EST 2008
Log message for revision 82933:
do not rely on private attributes in the context
make sure __init__ doesn't fail if content type is None
Changed:
U z3c.image/trunk/CHANGES.txt
U z3c.image/trunk/setup.py
U z3c.image/trunk/src/z3c/image/proc/adapter.py
U z3c.image/trunk/src/z3c/image/proc/browser.py
-=-
Modified: z3c.image/trunk/CHANGES.txt
===================================================================
--- z3c.image/trunk/CHANGES.txt 2008-01-17 12:21:39 UTC (rev 82932)
+++ z3c.image/trunk/CHANGES.txt 2008-01-17 12:47:14 UTC (rev 82933)
@@ -2,6 +2,13 @@
Changes for z3c.image
=====================
+2008/01/17 0.1.5:
+=================
+
+- do not rely on private attributes in the context
+- make sure __init__ doesn't fail if content type is None
+
+
2008/01/16 0.1.4:
=================
Modified: z3c.image/trunk/setup.py
===================================================================
--- z3c.image/trunk/setup.py 2008-01-17 12:21:39 UTC (rev 82932)
+++ z3c.image/trunk/setup.py 2008-01-17 12:47:14 UTC (rev 82933)
@@ -2,7 +2,7 @@
setup(
name = "z3c.image",
- version = "0.1.4",
+ version = "0.1.5",
author = "Zope Contributors",
author_email = "office at mopacreative.com",
description = "Image utils for zope3",
Modified: z3c.image/trunk/src/z3c/image/proc/adapter.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/adapter.py 2008-01-17 12:21:39 UTC (rev 82932)
+++ z3c.image/trunk/src/z3c/image/proc/adapter.py 2008-01-17 12:47:14 UTC (rev 82933)
@@ -34,12 +34,15 @@
component.adapts(IFile)
implements(IProcessableImage)
- def __init__(self,image):
+ def __init__(self, image):
self.context = image
- try:
- self.format = image.contentType.split('/')[1]
- except IndexError:
- self.format = ''
+ self.format = ''
+ contentType = image.contentType
+ if contentType is not None:
+ try:
+ self.format = image.contentType.split('/')[1]
+ except IndexError:
+ pass
self.cmds = []
def getPILImg(self):
Modified: z3c.image/trunk/src/z3c/image/proc/browser.py
===================================================================
--- z3c.image/trunk/src/z3c/image/proc/browser.py 2008-01-17 12:21:39 UTC (rev 82932)
+++ z3c.image/trunk/src/z3c/image/proc/browser.py 2008-01-17 12:47:14 UTC (rev 82933)
@@ -66,12 +66,16 @@
self._calcAfterSize()
def _resultingRatio(self):
- if self.cropW is not None and self.cropH is not None and \
- self.cropW != 0 and self.cropH != 0:
+ if ( self.cropW is not None
+ and self.cropH is not None
+ and self.cropW != 0
+ and self.cropH != 0
+ ):
ratio = float(self.cropW) / float(self.cropH)
else:
context = removeSecurityProxy(self.context)
- ratio = float(context._width) / float(context._height)
+ t,w,h = getImageInfo(context.data)
+ ratio = float(w) / float(h)
return ratio
def _calcAfterSize(self):
More information about the Checkins
mailing list