[Zope] Relative URL property?
StefanH.Holek
StefanH.Holek
Sat, 15 Feb 2003 14:11:58 +0100
Please note that absolute_url(1) gives you the path *relative to a
virtual root*. This may not be what you want as it fails to support
inside-out virtual hosting.
This has bitten me twice recently so I came up with a new API:
http://collector.zope.org/Zope/809
Stefan
On Samstag, Feb 15, 2003, at 02:26 Europe/Vienna, Andy McKay wrote:
> Kamal Gill wrote:
>> I know there must be a simple answer to this question, but I have
>> thus far been unable to find it.
>> How do I obtain the relative URL of each object in the list of
>> search results?
>> For example, if I have an page template named "foo.html" in folder
>> "/spam/eggs/" listed as a search result, how do I obtain
>> "/spam/eggs/foo.html"? There does not seem to be a relative_url
>> property, similar to absolute_url but without the
>> "http://servername.xyz" prefix.
>
> absolute_url(1) gives you this, however without a leading /
>
> If you wanted to, you could make a python script called relative_url
> that did:
>
> return '/'+context.absolute_url(1)
> --
> Andy McKay