Cf "virtual hosting leads to broken urls" on LinkProblems. I'm trying to get a handle on this situation now. Here is my guess-recollection of the key points:

both on a page and one level deeper in the backlinks/editform. The first naive implementation worked out the path by walking up to the zodb root (1):

def wiki_page_url(self):
    """return the url path for the current wiki page"""
    o = self
    url = []
    while hasattr(o,'id'):
        url.insert(0,absattr(o.id))
        o = getattr(o,'aq_parent', None)
    return quote('/' + join(url[1:],'/'))

def wiki_base_url(self):
    etc..

and it went into the codebase (around v0.7 ?). Since then, we've had

<!----> (5) went into the code after 0.8.1 and is still there (slightly modified) in 0.9.2. It works with zwiki.org's virtual hosting configuration and on non-virtual hosts. My impression is that so far it causes the least breakage - I don't have a sense of how much breakage that is though.

<dtml-comment> |||||| result of alternatives in the present environment: || || || wiki_base_url: || wiki_page_url: || ||(1) ||&dtml-wiki_base_url1; ||&dtml-wiki_page_url1; || ||(2) ||&dtml-wiki_base_url2; ||&dtml-wiki_page_url2; || ||(3) ||&dtml-wiki_base_url3; ||&dtml-wiki_page_url3; || ||(4) ||&dtml-wiki_base_url4; ||&dtml-wiki_page_url4; || ||(5) ||&dtml-wiki_base_url5; ||&dtml-wiki_page_url5; || ||(6) ||&dtml-wiki_base_url6; ||&dtml-wiki_page_url6; || ||(7) ||&dtml-wiki_base_url7; ||&dtml-wiki_page_url7; || </dtml-comment>

So I'm ready to write unit tests, except I'm still too confused. Do we have a problem ? Would you post or contact me if you can produce a failure with 0.9.x code ([zwikidir/releases/ZWiki-0.9.3.tgz]?) or share some insight ? --SM

LaloMartins -- Fri, 4 May 2001 23:40:28 -0300

I think absolute links (with 'self.absolute_url()') are more robust anyway. In my own version (based on WFN), I'm using absolute links, altough for a completely different reason (I have a "wiki-tree" that spans trough folders). However, the testbed site for this version uses virtual hosting and it's working like a charm.

(Actually, I was wondering why the links were relative to begin with. I mean, why all that pain, when absolute links are more robust and almost guaranteed to work?)