[PATCH 2 of 3] Fix hgwebdir collections when the baseurl option is set

Emanuele Aina emanuele.aina at gmail.com
Wed May 7 17:31:41 CDT 2008


Dirkjan Ochtman domandò:

> >                  if req.env['SCRIPT_NAME']:
> >                      parts.insert(0, req.env['SCRIPT_NAME'])
> > -                url = ('/'.join(parts).replace("//", "/")) + '/'
> > +                url = slashes.sub('/', '/'.join(parts) + '/')
> > 
> >                  # update time with local timezone
> >                  try:
> 
> This feels a little ugly to me. Could we use urlparse.urljoin() here?

I thought about it, but unfortunately urljoin
1) doesn't always add a path level (which is what we want here):
   urlparse.urljoin('http://example.com/bar', 'foo')
   'http://example.com/foo'
2) doesn't normalize double slahes in the url:
   urlparse.urljoin('http://example.com//bar/', 'foo')
   'http://example.com//bar/foo'

-- 
Buongiorno.
Complimenti per l'ottima scelta.



More information about the Mercurial-devel mailing list