[Checkins] SVN: Products.CMFDefault/trunk/Products/CMFDefault/ Make sure `id` is always an attribute and not a method.
Hanno Schlichting
hannosch at hannosch.eu
Sun Jul 17 14:49:11 EDT 2011
Log message for revision 122271:
Make sure `id` is always an attribute and not a method.
Changed:
U Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
U Products.CMFDefault/trunk/Products/CMFDefault/File.py
U Products.CMFDefault/trunk/Products/CMFDefault/Image.py
U Products.CMFDefault/trunk/Products/CMFDefault/tests/test_File.py
U Products.CMFDefault/trunk/Products/CMFDefault/tests/test_Image.py
-=-
Modified: Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt 2011-07-17 18:38:55 UTC (rev 122270)
+++ Products.CMFDefault/trunk/Products/CMFDefault/CHANGES.txt 2011-07-17 18:49:11 UTC (rev 122271)
@@ -4,6 +4,8 @@
2.3.0-alpha (unreleased)
------------------------
+- Make sure `id` is always an attribute and not a method.
+
- DublinCore: 'getMetadataHeaders' now returns the Type ID, not the Type title.
This avoids conflicts between unicode messages and encoded non-ASCII strings.
Modified: Products.CMFDefault/trunk/Products/CMFDefault/File.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/File.py 2011-07-17 18:38:55 UTC (rev 122270)
+++ Products.CMFDefault/trunk/Products/CMFDefault/File.py 2011-07-17 18:49:11 UTC (rev 122271)
@@ -98,6 +98,7 @@
effective_date = expiration_date = None
icon = PortalContent.icon
+ id = None
manage_options = manage_options
@@ -134,12 +135,6 @@
, contributors, effective_date, expiration_date
, format, language, rights )
- # For old instances where bases had OFS.Image.File first,
- # the id was actually stored in __name__.
- # getId() will do the correct thing here, as id() is callable
- def id(self):
- return self.__name__
-
security.declareProtected(View, 'SearchableText')
def SearchableText(self):
"""
Modified: Products.CMFDefault/trunk/Products/CMFDefault/Image.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/Image.py 2011-07-17 18:38:55 UTC (rev 122270)
+++ Products.CMFDefault/trunk/Products/CMFDefault/Image.py 2011-07-17 18:49:11 UTC (rev 122271)
@@ -98,6 +98,7 @@
effective_date = expiration_date = None
icon = PortalContent.icon
+ id = None
manage_options = manage_options
@@ -132,12 +133,6 @@
, contributors, effective_date, expiration_date
, format, language, rights )
- # For old instances where bases had OFS.Image.Image first,
- # the id was actually stored in __name__.
- # getId() will do the correct thing here, as id() is callable
- def id(self):
- return self.__name__
-
security.declareProtected(View, 'SearchableText')
def SearchableText(self):
"""
Modified: Products.CMFDefault/trunk/Products/CMFDefault/tests/test_File.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/tests/test_File.py 2011-07-17 18:38:55 UTC (rev 122270)
+++ Products.CMFDefault/trunk/Products/CMFDefault/tests/test_File.py 2011-07-17 18:49:11 UTC (rev 122271)
@@ -55,12 +55,10 @@
def test_getId_on_old_File_instance(self):
file = self._makeOne('testfile')
self.assertEqual(file.getId(), 'testfile')
- self.assertEqual(file.id, 'testfile')
# Mimick old instance when base classes had OFS.Image.File first
file.__name__ = 'testfile'
delattr(file, 'id')
self.assertEqual(file.getId(), 'testfile')
- self.assertEqual(file.id(), 'testfile')
def test_File_setFormat(self):
# Setting the DC.format must also set the content_type property
Modified: Products.CMFDefault/trunk/Products/CMFDefault/tests/test_Image.py
===================================================================
--- Products.CMFDefault/trunk/Products/CMFDefault/tests/test_Image.py 2011-07-17 18:38:55 UTC (rev 122270)
+++ Products.CMFDefault/trunk/Products/CMFDefault/tests/test_Image.py 2011-07-17 18:49:11 UTC (rev 122271)
@@ -71,12 +71,10 @@
def test_getId_on_old_Image_instance(self):
image = self.site._setObject('testimage', self._makeOne('testimage'))
self.assertEqual(image.getId(), 'testimage')
- self.assertEqual(image.id, 'testimage')
# Mimick old instance when base classes had OFS.Image.Image first
image.__name__ = 'testimage'
delattr(image, 'id')
self.assertEqual(image.getId(), 'testimage')
- self.assertEqual(image.id(), 'testimage')
def test_EditWithEmptyFile(self):
# Test handling of empty file uploads
More information about the checkins
mailing list