Ignore:
Timestamp:
8 Mar 2012, 19:00:51 (13 years ago)
Author:
uli
Message:

Rename all non-locales stuff from sirp to kofa.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/image/README.txt

    r7495 r7811  
    1 waeup.sirp.image -- handling image files
     1waeup.kofa.image -- handling image files
    22========================================
    33
    4 The image file widget is built on top of the :class:`SIRPImageFile` object::
    5 
    6   >>> from waeup.sirp.image import SIRPImageFile
    7   >>> file = SIRPImageFile('foo.jpg', 'mydata')
     4The image file widget is built on top of the :class:`KOFAImageFile` object::
     5
     6  >>> from waeup.kofa.image import KOFAImageFile
     7  >>> file = KOFAImageFile('foo.jpg', 'mydata')
    88  >>> file.filename
    99  'foo.jpg'
     
    1616  'mydata'
    1717
    18 We can also create SIRPImageFile objects from file-like objects::
     18We can also create KOFAImageFile objects from file-like objects::
    1919
    2020  >>> from StringIO import StringIO
     
    3636----------------
    3737
    38 The SIRPImageFile object normally stores the file data using ZODB
     38The KOFAImageFile object normally stores the file data using ZODB
    3939persistence. Files can however also be stored by tramline.  If
    4040tramline is installed in Apache, the Tramline takes care of generating
     
    7373just '1') will now be created::
    7474
    75   >>> file = SIRPImageFile('foo.jpg', '1')
     75  >>> file = KOFAImageFile('foo.jpg', '1')
    7676
    7777The data is now '1', referring to the real file::
     
    102102We expect the same behavior as when tramline is not installed::
    103103
    104   >>> file = SIRPImageFile('foo.jpg', 'data')
     104  >>> file = KOFAImageFile('foo.jpg', 'data')
    105105  >>> f = file.file
    106106  >>> f.read()
     
    114114  >>> shutil.rmtree(dirpath)
    115115
    116 Support for :mod:`waeup.sirp.imagestorage`
     116Support for :mod:`waeup.kofa.imagestorage`
    117117------------------------------------------
    118118
    119119The behaviour shown above can be used for any Zope3 application. With
    120 :mod:`waeup.sirp` we use a special file retrieval utility defined in
    121 :mod:`waeup.sirp.imagestorage`. As this utility is based on
    122 :mod:`waeup.sirp` internal stuff we do not show it here but in the
     120:mod:`waeup.kofa` we use a special file retrieval utility defined in
     121:mod:`waeup.kofa.imagestorage`. As this utility is based on
     122:mod:`waeup.kofa` internal stuff we do not show it here but in the
    123123tests that come with that storage type.
    124124
     
    135135The `ImageFile` field accepts only certain content types:
    136136
    137   >>> from waeup.sirp.image.schema import ImageFile
     137  >>> from waeup.kofa.image.schema import ImageFile
    138138  >>> from zope.publisher.browser import TestRequest
    139139  >>> field = ImageFile(__name__='foo', title=u'Foo')
     
    141141  Traceback (most recent call last):
    142142  ...
    143   WrongType: ('asd', <class 'waeup.sirp.image.image.SIRPImageFile'>, 'foo')
     143  WrongType: ('asd', <class 'waeup.kofa.image.image.KOFAImageFile'>, 'foo')
    144144
    145145which means: `ImageFile` fields should better contain
    146 :class:`SIRPImageFile` instances.
    147 
    148 We can store normal :class:`SIRPImageFile` instances:
    149 
    150   >>> field.validate(SIRPImageFile('bar.jpg', 'data')) is None
     146:class:`KOFAImageFile` instances.
     147
     148We can store normal :class:`KOFAImageFile` instances:
     149
     150  >>> field.validate(KOFAImageFile('bar.jpg', 'data')) is None
    151151  True
    152152
     
    173173
    174174  >>> field.validate(
    175   ...     SIRPImageFile('bar.jpg', '123456789012')) is None
    176   True
    177 
    178   >>> field.validate(
    179   ...     SIRPImageFile('bar.jpg', '12345')) is None
     175  ...     KOFAImageFile('bar.jpg', '123456789012')) is None
     176  True
     177
     178  >>> field.validate(
     179  ...     KOFAImageFile('bar.jpg', '12345')) is None
    180180  True
    181181
     
    183183
    184184  >>> field.validate(
    185   ...     SIRPImageFile('bar.jpg', '1234567890123'))
     185  ...     KOFAImageFile('bar.jpg', '1234567890123'))
    186186  Traceback (most recent call last):
    187187  ...
     
    189189
    190190  >>> field.validate(
    191   ...     SIRPImageFile('bar.jpg', '1234'))
     191  ...     KOFAImageFile('bar.jpg', '1234'))
    192192  Traceback (most recent call last):
    193193  ...
     
    198198----------------------------
    199199
    200 SIRPImageFile does not reproduce the broken unequal comparison from
     200KOFAImageFile does not reproduce the broken unequal comparison from
    201201its base:
    202202
    203   >>> f1 = SIRPImageFile('bar.jpg', '123456789')
    204   >>> f2 = SIRPImageFile('bar.jpg', '123456789')
    205   >>> f3 = SIRPImageFile('baz.jpg', '1234')
     203  >>> f1 = KOFAImageFile('bar.jpg', '123456789')
     204  >>> f2 = KOFAImageFile('bar.jpg', '123456789')
     205  >>> f3 = KOFAImageFile('baz.jpg', '1234')
    206206  >>> f1 == f2
    207207  True
Note: See TracChangeset for help on using the changeset viewer.