[CMF-checkins] SVN: CMF/branches/2.0/C CMFCore.FSImage: Supply class-level defaults for 'alt', 'height', and 'width'

Tres Seaver tseaver at palladion.com
Mon Nov 5 12:32:24 EST 2007


Log message for revision 81542:
  CMFCore.FSImage:  Supply class-level defaults for 'alt', 'height', and 'width'
  
  o Avoids acquiring objects with the same names
    (http://www.zope.org/Collectors/CMF/507)
  
  

Changed:
  U   CMF/branches/2.0/CHANGES.txt
  U   CMF/branches/2.0/CMFCore/FSImage.py
  U   CMF/branches/2.0/CMFCore/tests/test_FSImage.py

-=-
Modified: CMF/branches/2.0/CHANGES.txt
===================================================================
--- CMF/branches/2.0/CHANGES.txt	2007-11-05 17:32:05 UTC (rev 81541)
+++ CMF/branches/2.0/CHANGES.txt	2007-11-05 17:32:24 UTC (rev 81542)
@@ -2,6 +2,10 @@
 
   Bug Fixes
 
+    - CMFCore.FSImage:  Supply class-level defaults for 'alt', 'height',
+      and 'width', to avoid acquiring objects with the same names
+      (http://www.zope.org/Collectors/CMF/507)
+
     - Backported test fix from 2.1 branch which suppresses race conditions
       in date-based topic criteria tests.
 

Modified: CMF/branches/2.0/CMFCore/FSImage.py
===================================================================
--- CMF/branches/2.0/CMFCore/FSImage.py	2007-11-05 17:32:05 UTC (rev 81541)
+++ CMF/branches/2.0/CMFCore/FSImage.py	2007-11-05 17:32:24 UTC (rev 81542)
@@ -39,6 +39,10 @@
 
     meta_type = 'Filesystem Image'
 
+    alt = ''
+    height = ''
+    width = ''
+
     _data = None
 
     manage_options=(

Modified: CMF/branches/2.0/CMFCore/tests/test_FSImage.py
===================================================================
--- CMF/branches/2.0/CMFCore/tests/test_FSImage.py	2007-11-05 17:32:05 UTC (rev 81541)
+++ CMF/branches/2.0/CMFCore/tests/test_FSImage.py	2007-11-05 17:32:24 UTC (rev 81542)
@@ -219,6 +219,23 @@
         self.failUnless('bar' in headers.keys())
         self.assertEqual(headers['test_path'], '/test_image')
 
+    def test_tag_with_acquired_clashing_attrs(self):
+        # See http://www.zope.org/Collectors/CMF/507
+        class Clash:
+            def __str__(self):
+                raise NotImplementedError
+
+        self.root.alt = Clash()
+        self.root.height = Clash()
+        self.root.width = Clash()
+
+        image = self._makeOne( 'test_image', 'test_image.gif' )
+        image = image.__of__( self.root )
+
+        tag = image.tag()
+        self.failUnless('alt=""' in tag)
+
+
 def test_suite():
     return unittest.TestSuite((
         unittest.makeSuite(FSImageTests),



More information about the CMF-checkins mailing list