[PATCH 3 of 3] Leave urlbase empty in templates if url is already absolute

Emanuele Aina em at nerd.ocracy.org
Sat May 31 06:59:45 CDT 2008


Patrick Mézard dubitò:

> > Problems arise when you use a full url for 'baseurl' in hgweb.config
> > (e.g. 'http://techn.ocracy.org'), as it will make {url} already complete
> > but it will nevertheless appended to {urlbase}.
> > 
> > I didn't make {url} always relative as it will break the web templates
> > when using 'baseurl'
> 
> Wouldn't it be the opposite ? Will break when not used with 'baseurl' ?

I meant when 'baseurl' is set and {urlbase} not used in the template.
Those names can lead to a bit of confusion... :)

> But the compatibility problem still holds.
> 
> What about adding an 'uri' parameter which would be the url part 
> without the scheme and domain part, and fix only the RSS template for now ?

I don't think that 'uri' is the right name, as an HTTP uri could be
absolute (starting with 'http://') or relative ('foo/bar.html').

Here we should store the local path from the root of the application
plus the query string.

Or, if we split each components:
http://techn.ocracy.org/hg/repo/rev/ab08de645db9?style=raw
|---------------------|--|---------------------|---------|
        {domain}     {root}        {path}        {query}

If we set {urlbase} to {domain}{root} and {url} to {root}{path}{query}
then {urlbase}{url} is broken (root repeated).

With {urlbase} set to {domain} and {url} to {root}{path}{query} then
loading the CSS is broken ({root} is missing from its url).

With {urlbase} set to {domain}{root} and {url} to {path}{query} then
the templates which do not use urlbase are broken.

-- 
Buongiorno.
Complimenti per l'ottima scelta.



More information about the Mercurial-devel mailing list