[Zope] method for checking existence of documents
Tino Wildenhain
tino@wildenhain.de
Sun, 20 May 2001 04:09:22 +0200
Hi Jan,
--On Sonntag, 20. Mai 2001 03:26 +0200 Jan Sew <esolutions@gmx.net> wrote:
> hello,
>
> can anyone tell me where to find a dtml method or python script that
> checks whether a special document in a zope folder exists when called.
> dependend on this query i would like to carry out actions.
>
> if "file exists"
> ....
>
> else
> ....
>
> thanks a lot,
Although Zope uses the term "folder" these objects are not very
similar to a filesystem folder. In fact, _every_ zope object
can (and would) have subobjects. Just to clarify this out.
Zope is only a tree of objects, subobjects, subsubobjects and
so on. (See your favourite python manual)
In your case, if your namespace is mapped to _
you can use:
if hasattr(_,'yoursciptobject'):
...
or in DTML you would write
<dtml-if yourscriptobject>
...
</dtml-if>
Please note: because of acquisition, subobjects with the
same id are looked up on parent request containers.
HTH
Tino Wildenhain