Ignore:
Timestamp:
6 Jun 2011, 02:31:41 (14 years ago)
Author:
uli
Message:

Fix bug #32.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/image/image.py

    r5979 r6284  
    2323Components for handling image files.
    2424"""
     25from StringIO import StringIO
    2526from hurry.file import HurryFile
     27from hurry.file.interfaces import IFileRetrieval
     28from zope.component import queryUtility
    2629from zope.interface import implements
    2730from waeup.sirp.image.interfaces import IWAeUPImageFile
     
    3336    """
    3437    implements(IWAeUPImageFile)
     38
     39    def _get_file(self):
     40        """Get the real file.
     41
     42        We have to override this method from
     43        :class:`hurry.file.HurryFile` base because we need a more
     44        careful utility lookup.
     45        """
     46        storage = queryUtility(IFileRetrieval)
     47        if storage is None:
     48            # can happen on startup, see https://trac.waeup.org/ticket/32
     49            return StringIO(self.data)
     50        return storage.getFile(self.data)
     51
     52    file = property(_get_file)
Note: See TracChangeset for help on using the changeset viewer.