source: main/waeup.sirp/trunk/src/waeup/sirp/image/image.py @ 7433

Last change on this file since 7433 was 7321, checked in by Henrik Bettermann, 13 years ago

Replace the term 'WAeUP' by SIRP which is a WAeUP product.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1## $Id: image.py 7321 2011-12-10 06:15:17Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19Components for handling image files.
20"""
21from hurry.file import HurryFile
22from hurry.file.interfaces import IFileRetrieval
23from zope.component import getUtility
24from zope.interface import implements
25from waeup.sirp.image.interfaces import ISIRPImageFile
26
27class SIRPImageFile(HurryFile):
28    """A file prepared for storing image files.
29
30    This file type is built upon :class:`hurry.file.HurryFile` but
31    implements a derived marker interface to distuingish it from
32    regular hurry files.
33
34    To create a :class:`SIRPImageFile` you should use
35    :func:`createSIRPImageFile`.
36    """
37    implements(ISIRPImageFile)
38
39    def __ne__(self, other):
40        # This was wrongly implemented in the base class
41        try:
42            return (self.filename != other.filename or
43                    self.data != other.data)
44        except AttributeError:
45            return True
46
47def createSIRPImageFile(filename, f):
48    retrieval = getUtility(IFileRetrieval)
49    return retrieval.createFile(filename, f)
Note: See TracBrowser for help on using the repository browser.