[Zope] Convert URL to object

Michel Pelletier michel@digicool.com
Mon, 01 Nov 1999 10:39:39 -0500


Phil Harris wrote:
> 
> Hi Itamar,
> 
> Well I have done this with an external method.
> 
> Something on the lines of (untested in this form)
> 
> def urlToobject(self, url=None):
>         string.replace(url,'/','.')
>         return eval(url)

There is an existing method that works better for this:

<dtml-with "REQUEST.resolve_url(Link)">
  blah
</dtml-with>

'Link' must be well formed, I believe it must be an absolute URL, but
I'm not sure.  Maybe just a path '/x/y' will work.

-Michel