On Tue, 2011-04-19 at 17:07 +0200, Stephen Butler wrote:
> On Apr 19, 2011, at 15:32 , Neels Hofmeyr wrote:
>
> >>>>
> >>>> This attached patch fixes three issues with the script:
> >>>> 1) use of file:// when I'm sure that file:/// is correct from previous discussions on this list
> >
> > This particular change is not necessary -- code extract with
> > annotations:
> >
> > base = tempfile.mkdtemp() # base == '/tmp/dir123'
> > repos = j(base, 'repos') # repos == '/tmp/dir123/repos'
> > file_url = 'file://%s' % repos # file_url == 'file://' + '/tmp/...'
> >
> > With your change, file_url becomes file:////tmp/..., which is still
> > valid, but nonsense :) (BTW, the script would not have worked if there
> > had been only two slashes.)
>
> On Windows, the path returned by mkdtemp() is something like
>
> C:\users\billga~1\appdata\local\temp\tmpfoobar
>
> with no leading slash, so an extra slash makes the URL valid.
gotcha!
Thanks, Steve, I wasn't aware of that. Sorry, Alan, I am hopelessly
unix. Let me paraphrase. Hopefully unix.
So we need a special treatment. Like
file_url = 'file://'
if not base.startswith('/'):
file_url.append('/')
...or leave the four slashes, that's also fine, actually.
~Neels
Received on 2011-04-19 18:29:00 CEST