[Zope] stopping indexing of acquired attributes

Luca Olivetti luca@wetron.es
Mon, 30 Dec 2002 09:20:53 +0100


I'm not really sure this is a problem but I have a feeling that it will 
bite me later on. Anyway..

I have defined a class that's both a container and has properties of its 
  own. The class (it's a CMF class) derives from SkinnedFolder, 
PortalContent and DefaultDublinCoreImpl.
The problem is that many of the attributes are only meaningful for the 
object itself, not for the contained objects. This doesn't really bother 
me, but I would like to avoid indexing (and putting in the metadata) 
these attributes.
So, I cannot use attributes starting with _ to stop acquisition since 
this would preclude putting them in the index/metadata.
I cannot use Aquisition.explicit since I have no control on the 
contained objects (in fact the purpose of having a class deriving on 
SkinnedFolder is to use existing types as content).
I've tried, with no success, the following:


class MyClass(SkinnedFolder, PortalContent, DefaultDublinCoreImpl):

    ....
    ....

    def MyAttr(self):
       if not isinstance(aq_base(self),MyClass):
          return None
       ....
       ....

No success because when the method gets called self is an instance of 
MyClass, so the method never returns None.

Any hint?

TIA

-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007