[Zope-CMF] How to get Type in manage_afterAdd?

Dieter Maurer dieter@handshake.de
Fri, 1 Feb 2002 19:55:26 +0100


Jon Edwards writes:
 > >     if not hasattr(self, 'index.htm'):
 > >         addDocument(self, id = 'index.htm')
 > >
 > > so that it won't try to re-add the Document if it already exists.
 > 
 > Sorry, it was working! I was working on two files at once and testing the
 > wrong one :-)
 > 
 > But in case anyone is trying anything similar, you need aq_explicit in there
 > to stop it using acquisition and accidentally finding your id in a higher
 > folder -
 > 
 >   if not hasattr(self.aq_explicit, 'index.htm'):
If fact, you probably even need "aq_base":

  If "self" is acquisition wrapped, then it has two components
  "s" and "p" ("self" and "parent"). "aq_explicit" is enough,
  when "s" is not itself acquisition wrapped. If it is, you
  may still see acquired attributes. "aq_base" unwraps at long
  as is necessary to get at the unwrapped object.


Dieter