[Zope] ONLY in python script

Peter Bengtsson peter@grenna.net
Thu, 19 Apr 2001 17:45:54 +0200


assuming this folder structure:

 /main
    /zopestuff
    /misc
    /otherstuff

If I do this in python script:

if hasattr(context.main,'zopestuff'):
  # it returns TRUE!!
  return "found in /main/"

But also, if I do it in or /misc or /otherstuff

if hasattr(context.main.misc,'zopestuff'):
  # if returns TRUE!
  return "found in /main/misc/"

This is because of aquisition, right.
So HOW do I prevent this it happen? I want it only to true with what is
called ONLY in DTML.

I.e. to get the effect I'm after I would do:
<dtml-with "main.misc" only>
  <dtml-if zopestuff> # This not true </dtml-if>
</dtml-with>



Peter