[CMF-checkins] SVN: CMF/branches/1.6/CMFDefault/ * remove misleading comments re: base class ordering from File and

Rob Miller ra at burningman.com
Tue Nov 29 02:45:25 EST 2005


Log message for revision 40401:
  * remove misleading comments re: base class ordering from File and
    Image classes
  
  * have File.index_html explicitly delegate to OFS.Image.File.index_html
    to prevent the default view failure that results from PortalContent's
    use of None in this case
  
  

Changed:
  U   CMF/branches/1.6/CMFDefault/File.py
  U   CMF/branches/1.6/CMFDefault/Image.py

-=-
Modified: CMF/branches/1.6/CMFDefault/File.py
===================================================================
--- CMF/branches/1.6/CMFDefault/File.py	2005-11-29 06:29:11 UTC (rev 40400)
+++ CMF/branches/1.6/CMFDefault/File.py	2005-11-29 07:45:24 UTC (rev 40401)
@@ -110,19 +110,6 @@
         A Portal-managed File
     """
 
-    # The order of base classes is very significant in this case.
-    # Image.File does not store it's id in it's 'id' attribute.
-    # Rather, it has an 'id' method which returns the contents of the
-    # instnace's __name__ attribute.  Inheriting in the other order
-    # obscures this method, resulting in much pulling of hair and
-    # gnashing of teeth and fraying of nerves.  Don't do it.
-    #
-    # Really.
-    # 
-    # Note that if you use getId() to retrieve an object's ID, you will avoid
-    # this problem altogether. getId is the new way, accessing .id is
-    # deprecated.
-
     __implements__ = ( PortalContent.__implements__
                      , DefaultDublinCoreImpl.__implements__
                      )
@@ -165,6 +152,11 @@
                                , contributors, effective_date, expiration_date
                                , format, language, rights )
 
+    # use OFS.Image.File's index_html; PortalContent's will cause some
+    # circular behaviour w/ 'None' being returned as the default view
+    security.declareProtected(View, 'index_html')
+    index_html = OFS.Image.File.index_html
+
     # 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

Modified: CMF/branches/1.6/CMFDefault/Image.py
===================================================================
--- CMF/branches/1.6/CMFDefault/Image.py	2005-11-29 06:29:11 UTC (rev 40400)
+++ CMF/branches/1.6/CMFDefault/Image.py	2005-11-29 07:45:24 UTC (rev 40401)
@@ -102,19 +102,6 @@
         A Portal-managed Image
     """
 
-    # The order of base classes is very significant in this case.
-    # Image.Image does not store it's id in it's 'id' attribute.
-    # Rather, it has an 'id' method which returns the contents of the
-    # instnace's __name__ attribute.  Inheriting in the other order
-    # obscures this method, resulting in much pulling of hair and
-    # gnashing of teeth and fraying of nerves.  Don't do it.
-    #
-    # Really.
-    # 
-    # Note that if you use getId() to retrieve an object's ID, you will avoid
-    # this problem altogether. getId is the new way, accessing .id is
-    # deprecated.
-
     __implements__ = ( PortalContent.__implements__
                      , DefaultDublinCoreImpl.__implements__
                      )



More information about the CMF-checkins mailing list