[Checkins] SVN: CMF/trunk/CMFDefault/ - added image interfaces

Yvo Schubbe y.2007- at wcm-solutions.de
Wed Feb 14 07:25:15 EST 2007


Log message for revision 72568:
  - added image interfaces

Changed:
  U   CMF/trunk/CMFDefault/Image.py
  U   CMF/trunk/CMFDefault/interfaces/_content.py
  U   CMF/trunk/CMFDefault/tests/test_Image.py

-=-
Modified: CMF/trunk/CMFDefault/Image.py
===================================================================
--- CMF/trunk/CMFDefault/Image.py	2007-02-14 12:19:25 UTC (rev 72567)
+++ CMF/trunk/CMFDefault/Image.py	2007-02-14 12:25:15 UTC (rev 72568)
@@ -31,6 +31,8 @@
 from Products.GenericSetup.interfaces import IDAVAware
 
 from DublinCore import DefaultDublinCoreImpl
+from interfaces import IImage
+from interfaces import IMutableImage
 from permissions import ModifyPortalContent
 from permissions import View
 
@@ -78,7 +80,7 @@
     """A Portal-managed Image.
     """
 
-    implements(IDAVAware)
+    implements(IMutableImage, IImage, IDAVAware)
     __implements__ = ( PortalContent.__implements__
                      , DefaultDublinCoreImpl.__implements__
                      )

Modified: CMF/trunk/CMFDefault/interfaces/_content.py
===================================================================
--- CMF/trunk/CMFDefault/interfaces/_content.py	2007-02-14 12:19:25 UTC (rev 72567)
+++ CMF/trunk/CMFDefault/interfaces/_content.py	2007-02-14 12:25:15 UTC (rev 72568)
@@ -126,3 +126,23 @@
 
     """ Updatable form of IFile.
     """
+
+    def manage_upload(file='', REQUEST=None):
+        """ Replaces the current data of the object with file.
+        """
+
+
+class IImage(IFile):
+
+    """ Image content.
+    """
+
+    def __str__():
+        """ Get the default HTML 'img' tag for this image.
+        """
+
+
+class IMutableImage(IImage, IMutableFile):
+
+    """ Updatable form of IImage.
+    """

Modified: CMF/trunk/CMFDefault/tests/test_Image.py
===================================================================
--- CMF/trunk/CMFDefault/tests/test_Image.py	2007-02-14 12:19:25 UTC (rev 72567)
+++ CMF/trunk/CMFDefault/tests/test_Image.py	2007-02-14 12:25:15 UTC (rev 72568)
@@ -52,6 +52,18 @@
         self.site = DummySite('site')
         self.site._setObject( 'portal_membership', DummyTool() )
 
+    def test_z3interfaces(self):
+        from zope.interface.verify import verifyClass
+        from Products.CMFDefault.interfaces import IFile
+        from Products.CMFDefault.interfaces import IImage
+        from Products.CMFDefault.interfaces import IMutableFile
+        from Products.CMFDefault.interfaces import IMutableImage
+
+        verifyClass(IFile, self._getTargetClass())
+        verifyClass(IImage, self._getTargetClass())
+        verifyClass(IMutableFile, self._getTargetClass())
+        verifyClass(IMutableImage, self._getTargetClass())
+
     def test_getId_on_old_Image_instance(self):
         image = self.site._setObject('testimage', self._makeOne('testimage'))
         self.assertEqual(image.getId(), 'testimage')



More information about the Checkins mailing list