[Zope-CMF] index_html acquisition

Troy Farrell troy@entheossoft.com
Wed, 14 May 2003 00:10:56 -0500


No, this isn't strange at all.  The line of code that says

del(self.index_html)

probably is never executed since your class doesn't have an index_html 
attribute.  It inherits one from PortalContent.  Chris wanted you to set 
the index_html attribute to Acquisition.Acquiried:

import Acquisition
from Products.CMFCore.PortalContent import PortalContent

class MyClass(PortalContent):
   """ a class """

   index_html = Acquision.Acquired

   def __init__(self,...):
     """ do something """


I suppose instead you could add this line to your __init__():

setattr(self,'index_html',Acquision.Acquired)

Hope that helps.
Troy

David Hart wrote:
> Chris Withers wrote:
> 
>> David Hart wrote:
>>
>>> I've discovered PortalContent is setting index_html = None.
>>>
>>> Is there any way this variable can be 'unset' to re-enable 
>>> acquisition of index_html?
>>
>>
>> in your class do:
>>
>>     index_html = Acquisition.Acquired
>>
>> ...make sure you import the Acquisition module somewhere too ;-)
> 
> 
> 
> Thanks for the tip! This sure looks like it should work, but it doesn't 
> (when in __init__)
> 
> Last week, I had this in __init__:
> 
>    def __init__( self, id, title='', description='' ):
>        """Initialize"""
>        if hasattr(self, 'index_html'):
>         del(self.index_html)
> 
> Which worked fine. Upon coming back to testing this week, a page render 
> throws this error:
> 
> Module Products.AtlantisBlueProduct.TestObject, line 105, in __init__
> KeyError: index_html (Also, an error occurred while attempting to render 
> the standard error message.)
> 
> Isn't that strange??
> 
> -dave