[Zope] test for an object's existence -->based on URL?

Kevin Dangoor kid@kendermedia.com
Fri, 28 Apr 2000 21:12:51 -0400


----- Original Message -----
From: "Kevin Howe" <khowe@performance-net.com>
To: "ZOPE Mailing List" <zope@zope.org>; "Chris McDonough"
<chrism@digicool.com>
Sent: Friday, April 28, 2000 6:45 PM
Subject: Re: [Zope] test for an object's existence -->based on URL?


> Is it possible to do this given a URL (short of parsing the URL and
plugging
> it into the "hasattr" tag)?

I think you can just capture the exception...

> something like this:
>
> <dtml-if "REQUEST.resolve_url.hasattr('http://domain/my/object')">
>   do something
> </dtml-if>

<dtml-try>
  <dtml-call "REQUEST.set('thatobj',
REQUEST.resolve_url('http://your/url'))">
  do your other stuff...
<dtml-except>
Not there...
</dtml-try>

Kevin