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. What I need to return is the relative URL for each search result, since the absolute_url property adds a port 8080 (e.g. http://servername.xyz:8080/spam/eggs/foo.html), assuming Zope is running on port 8080. I'm aware of "request/URLPATH0", but this does not work for the list of search results returned by a ZCatalog search interface. Any help is much appreciated. - Kamal _______________________ Kamal Gill Web Developer Library and Center for Knowledge Management University of California, San Francisco
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
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
Fantastic. absolute_url(1) works in returning the relative url in my python-generated breadcrumbs script and site map. However, it does not return the relative url in search results. Dieter suggests using the getpath() method to return the relative url in search results, which works perfectly. Many thanks for your help, Andy. - Kamal On Friday, February 14, 2003, at 05:26 PM, 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
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Kamal Gill wrote at 2003-2-14 17:21 -0800:
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. What I need to return is the relative URL for each search result, since the absolute_url property adds a port 8080 (e.g. http://servername.xyz:8080/spam/eggs/foo.html), assuming Zope is running on port 8080. Does the "getPath()" method does not return a relative URL?
Dieter
Fantastic. The getpath() method does return a relative url, but I was not aware of it. Many thanks for your help, Dieter. - Kamal On Sunday, February 16, 2003, at 03:04 PM, Dieter Maurer wrote:
Kamal Gill wrote at 2003-2-14 17:21 -0800:
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. What I need to return is the relative URL for each search result, since the absolute_url property adds a port 8080 (e.g. http://servername.xyz:8080/spam/eggs/foo.html), assuming Zope is running on port 8080. Does the "getPath()" method does not return a relative URL?
Dieter
participants (4)
-
Andy McKay -
Dieter Maurer -
Kamal Gill -
Stefan H. Holek