[Zope] Problem with ZCatalog output and SiteAccess (with workaround)

Marcin Kasperski Marcin.Kasperski@softax.com.pl
Wed, 26 Jul 2000 09:16:22 +0200


In short: ZCatalog getpath method returns sth. like
	'/public/the/path/to/found/object'
It causes the problem when one uses SiteAccess to modify URL paths
(let's say I use Apache mod_proxy to redirect http://my.host/zope to
http://my.host:8080/public and set SiteAccess in public zope dir to
return http://my.host/zope). URL's generated from ZCatalog searches via
'tutorial way':

<a href="<dtml-var "catalog.getpath(data_record_id_)">">

does not work. I get sth like
http://my.host/public/the/path/to/found/object (and Apache claims no
/public directory on server).

The problem can be solved via via converting fully specified link
returned by getpath to relative link (in most cases it is enough to
split this string on slash, remove 2 leading items and join it again) -
then I get correct URL without SiteAccess intervention.

Code snippet from zcatalog search result form:

<dtml-comment>
   This does not work with SiteAccess/proxying
	  <a href="<dtml-var "catalog.getpath(data_record_id_)">">
</dtml-comment>
<dtml-let page_path="catalog.getpath(data_record_id_)"
	  page_split="_.string.split(page_path,'/')" 
	  final_path="_.string.join(page_split[2:],'/')" >
     <a href="<dtml-var "final_path">">
</dtml-let>
         <dtml-var title></a>

This is rather workaround than clean solution. I can imagine two 'true'
solutions:
- patching ZCatalog to return relative URLs only
- patching SiteAccess to do something with '/such/urls' (is it
possible?)

--
Marcin.Kasperski | You have the right to change your mind, to substitute
  @softax.com.pl | functionality, and to change priorities. (Ken Beck's 
Marcin.Kasperski | Third Customer Right)                                
    @bigfoot.com |