[CMF-checkins] CVS: CMF - FSImage.py:1.5

Martijn Pieters mj@digicool.com
Thu, 12 Apr 2001 19:16:09 +0200


On Thu, Apr 12, 2001 at 01:51:59PM -0400, Tres Seaver wrote:
> Update of /cvs-repository/CMF/CMFCore
> In directory korak:/tmp/cvs-serv17913
> 
> Modified Files:
> 	FSImage.py 
> Log Message:
> * Try again on the pesky image load problem.
> 
> 
> --- Updated File FSImage.py in package CMF --
> --- FSImage.py	2001/04/12 17:15:33	1.4
> +++ FSImage.py	2001/04/12 17:51:57	1.5
> @@ -130,10 +130,16 @@
>          # Only parse out image info if the file was changed, because this file
>          # is read every time the image is requested.
>          try:    mtime=os.stat(fp)[8]
> -        except: mtime=-1
> +        except: mtime=0
>          if mtime != self._file_mod_time:
>              self._file_mod_time = mtime
> -            (self.content_type, self.width, self.height) = getImageInfo(data)
> +        ct, width, height = getImageInfo( data )
> +        if ct != getattr( self, 'content_type', None ):
> +            self.content_type = ct
> +        if width != getattr( self, 'width', None ):
> +            self.width = width
> +        if height != getattr( self, 'height', None ):
> +            self.height = height
>  
>          return data

What actually goes wrong here? My code tried to avoid having to hit
getImageInfo every time the object was accessed, not avoiding excessive
ZODB writes (although that is to be avoided as well maybe).

-- 
Martijn Pieters
| Software Engineer  mailto:mj@digicool.com
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
---------------------------------------------