コード例 #1
0
 def __init__(self, image_format_mapper, image_id, size, target_format):
     """ @param size: a (width, height) tuple
         @raise ImageFormatNotSupportedException: when the given format is not supported by the underlying image_format_mapper
     """
     self._image_format_mapper = ImageFormatMapper(image_format_mapper)
     if not self._image_format_mapper.supports_format(target_format):
         raise ImageFormatNotSupportedException(target_format)
     
     self.image_id = image_id
     self.size = size
     self.target_format = target_format
コード例 #2
0
class TransformationRequest(object):
    """ Stores the parameters of an image processing request """
    def __init__(self, image_format_mapper, image_id, size, target_format):
        """ @param size: a (width, height) tuple
            @raise ImageFormatNotSupportedException: when the given format is not supported by the underlying image_format_mapper
        """
        self._image_format_mapper = ImageFormatMapper(image_format_mapper)
        if not self._image_format_mapper.supports_format(target_format):
            raise ImageFormatNotSupportedException(target_format)
        
        self.image_id = image_id
        self.size = size
        self.target_format = target_format

    def __str__(self):
        return "TransformationRequest: %s %s %s" % (self.image_id, self.size, self.target_format)