diff --git a/IPython/lib/display.py b/IPython/lib/display.py index 5a89bc6..b60d3f5 100644 --- a/IPython/lib/display.py +++ b/IPython/lib/display.py @@ -4,7 +4,7 @@ Authors : MinRK, gregcaporaso """ from os import walk -from os.path import join, exists, isfile, splitext +from os.path import exists, isfile, splitext class YouTubeVideo(object): @@ -74,7 +74,7 @@ class FileLink(object): self.result_html_suffix = result_html_suffix def _format_path(self): - fp = join(self.url_prefix,self.path) + fp = '/'.join([self.url_prefix,self.path]) return ''.join([self.result_html_prefix, self.link_str % (fp, self.path), self.result_html_suffix]) diff --git a/IPython/lib/tests/test_display.py b/IPython/lib/tests/test_display.py index b16f412..95612d0 100644 --- a/IPython/lib/tests/test_display.py +++ b/IPython/lib/tests/test_display.py @@ -44,12 +44,7 @@ def test_existing_path_FileLink(): tf = NamedTemporaryFile() fl = display.FileLink(tf.name) actual = fl._repr_html_() - # Note: this is a bit awkward since tf.name has to be a full path - # for it to exist, but that won't happen in our applications. While - # in practice "files/" would be prepended to the href path, os.join - # doesn't do that if the second value is an absolute path. So, the - # expected here is slightly different than what we get in practice. - expected = "%s
" % (tf.name,tf.name) + expected = "%s
" % (tf.name,tf.name) nt.assert_equal(actual,expected) #-------------------------- @@ -74,13 +69,8 @@ def test_existing_path_FileLinks(): actual = fl._repr_html_() actual = actual.split('\n') actual.sort() - # Note: this is a bit awkward since tf.name has to be a full path - # for it to exist, but that won't happen in our applications. While - # in practice "files/" would be prepended to the href path, os.join - # doesn't do that if the second value is an absolute path. So, the - # expected here is slightly different than what we get in practice. - expected = ["%s
" % (tf2.name,tf2.name.split('/')[-1]), - "%s
" % (tf1.name,tf1.name.split('/')[-1])] + expected = ["%s
" % (tf2.name,tf2.name), + "%s
" % (tf1.name,tf1.name)] expected.sort() # We compare the sorted list of links here as that's more reliable nt.assert_equal(actual,expected) @@ -103,10 +93,5 @@ def test_existing_path_FileLinks(): td = mkdtemp() dl = display.DirectoryLink(td) actual = dl._repr_html_() - # Note: this is a bit awkward since tf.name has to be a full path - # for it to exist, but that won't happen in our applications. While - # in practice "files/" would be prepended to the href path, os.join - # doesn't do that if the second value is an absolute path. So, the - # expected here is slightly different than what we get in practice. - expected = "%s
" % (td,td) + expected = "%s
" % (td,td) nt.assert_equal(actual,expected)