[Zope-dev] how to determine if an object is put at top level?

Ava ava@dde974.equipement.gouv.fr
Fri, 21 Jan 2000 10:23:46 +0400


Hello,

I want to determine if an object has been *created* either in the toplevel
or lower in the hierarchy. How can I do this *reliably* ?

I found this code in Zope:

def isTop(self):
  try:
    return self.aq_parent.aq_base.isTopLevelPrincipiaApplicationObject
  except:
    return 0

This *doesn't* work if the object is acquired. e.g. if the object's id is
my_ob in the top level:

when browsing http://server/my_ob, my_ob notice that it is at top level
when browsing http://server/subfolder/my_ob, my_ob *does not* notice that it
is at top level with the above code.

How can I make this work? My product dynamically create content based on the
fact that it either at the top level or not. When the product is created,
the url is http://server/manage_addProduct/myproduct, and then it is *not*
at the top level from the product's point of view. However, the parameters
to initialize the product are dependent on whether it is at the toplevel or
not.

Thanks for any input. Please write to me directly to
minf7@educ.univ-reunion.fr (I'm not on the list)

Regards,

Jephte CLAIN
minf7@educ.univ-reunion.fr