Changeset 6309 for main/waeup.sirp/trunk/src/waeup/sirp/image
- Timestamp:
- 9 Jun 2011, 22:18:27 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/image/image.py
r6291 r6309 23 23 Components for handling image files. 24 24 """ 25 from StringIO import StringIO 25 import os 26 from ZODB.blob import Blob 26 27 from hurry.file import HurryFile 27 from hurry.file.interfaces import IFileRetrieval28 from zope.component import queryUtility29 28 from zope.interface import implements 30 29 from waeup.sirp.image.interfaces import IWAeUPImageFile … … 36 35 """ 37 36 implements(IWAeUPImageFile) 37 38 def __init__(self, filename, data): 39 self.filename = filename 40 self._file = Blob(data) 41 self.headers = {} 42 43 def _getFile(self): 44 return self._file.open('r') 45 46 file = property(_getFile) 47 48 @property 49 def size(self): 50 f = self._file.open('r') 51 size = int(os.fstat(f.fileno()).st_size) 52 f.close() 53 return size 54 55 @property 56 def data(self): 57 f = self._file.open('r') 58 result = f.read() 59 f.close() 60 return result
Note: See TracChangeset for help on using the changeset viewer.