[Zope-CMF] How to check if an object exists?

Josef Albert Meile jmeile@hotmail.com
Fri, 12 Oct 2001 19:31:18 +0200


> resolve_url raises the same error that a normal HTTP request would,
> e.g. NotFound, so you could do the following, for example:
>
>  <dtml-try>
>     <dtml-call "REQUEST.resolve_url
>       ('http://localhost:8080/MainPortal/myObjects/test')">
>     Supah.
>  <dtml-except NotFound>
>     Oh dear.
>  </dtml-try>
>
> seb

Thank you very much for your answer. You gave me the right hint. However, it
doesn't work with the "Not Found" Error on the <dtml-except> tag.
I don't know why. So I had to do the following and now it works:

<dtml-try>
  <dtml-call
"REQUEST.resolve_url('http://localhost:8080/MainPortal/myObjects/test')">
  Object Found
<dtml-except>
  <dtml-if expr="error_type=='Not Found'">
    Object not found.
  </dtml-if>
</dtml-try>