[Zope] acquired or not acquired ?

Dieter Maurer dieter@handshake.de
Fri, 26 Apr 2002 22:40:09 +0200


Joachim Schmitz writes:
 > If I have a pathinfo like
 > 
 > http://www.xxx.de/A/B
 > 
 > how can find out it B is a subobject of A, or if A and are on the same 
 > level ?
 > otherway around, how can I find out if my Zope-folders are:
 > 
 > A
 > B
 > 
 > A/B
My prefered solution would involve an External Method: "hasOwnAttribute",
implemented as:

	    from Acquisition import aq_base

	    def hasOwnAttribute(obj,attr):
	      return hasattr(aq_base(obj),attr)

and then test "hasOwnAttibute(A,'B')".


An alternative would be "'B' in A.objectIds()".



Dieter