Index: main/waeup.sirp/trunk/src/waeup/sirp/image/image.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/image/image.py	(revision 6535)
+++ main/waeup.sirp/trunk/src/waeup/sirp/image/image.py	(revision 6536)
@@ -23,7 +23,7 @@
 Components for handling image files.
 """
-import os
-from ZODB.blob import Blob
 from hurry.file import HurryFile
+from hurry.file.interfaces import IFileRetrieval
+from zope.component import getUtility
 from zope.interface import implements
 from waeup.sirp.image.interfaces import IWAeUPImageFile
@@ -32,60 +32,14 @@
     """A file prepared for storing image files.
 
-    This file type is built upon :class:`hurry.file.HurryFile`. It
-    stores the file contents given by `data` in a ZODB Blob.
+    This file type is built upon :class:`hurry.file.HurryFile` but
+    implements a derived marker interface to distuingish it from
+    regular hurry files.
 
-    The `filename` passed can be retrieved later as the `filename`
-    attribute although the contents of this parameter makes no
-    difference for us.
+    To create a :class:`WAeUPImageFile` you should use
+    :func:`createWAeUPImageFile`.
     """
     implements(IWAeUPImageFile)
 
-    def __init__(self, filename, data):
-        self.filename = filename
-        self._file = Blob(data)
-        self.headers = {}
-
-    def __del__(self):
-        """Remove the real filesystem file bound to the blob.
-
-        Blob content is initially written to some real filesystem
-        file. This file might linger around in temporary dirs when
-        :class:`WAeUPImageFile` instances are created without storing
-        them in ZODB afterwards. This often happens in tests.
-
-        We remove that file too when we are about to be deleted.
-        """
-        if self._p_oid is not None or self._file._p_oid is not None:
-            # Don't mess up internal ZODB structure
-            return
-        f = self._file.open('r')
-        name = getattr(f, 'name', None)
-        f.close()
-        if name is not None and os.path.exists(name) and os.path.isfile(name):
-            os.unlink(name)
-        return
-
-    def _getFile(self):
-        return self._file.open('r')
-
-    #: A Python file-object already openend for reading containing the
-    #: stored file.
-    file = property(_getFile)
-
-    @property
-    def size(self):
-        """The size of the stored file in bytes.
-        """
-        f = self._file.open('r')
-        size = int(os.fstat(f.fileno()).st_size)
-        f.close()
-        return size
-
-    @property
-    def data(self):
-        """The contents of the stored file.
-        """
-        f = self._file.open('r')
-        result = f.read()
-        f.close()
-        return result
+def createWAeUPImageFile(filename, f):
+    retrieval = getUtility(IFileRetrieval)
+    return retrieval.createFile(filename, f)
