From: Brian Warner Date: Wed, 30 Jan 2008 01:04:32 +0000 (-0700) Subject: webish: link to directory URIs rather than a child path. Addresses #103. X-Git-Tag: allmydata-tahoe-0.8.0~207 X-Git-Url: https://git.rkrishnan.org/components/?a=commitdiff_plain;h=d9d09201775ac3f3e205bdc70a24b1ecb2b4bc84;p=tahoe-lafs%2Ftahoe-lafs.git webish: link to directory URIs rather than a child path. Addresses #103. --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 69d9bb5b..6d241e90 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -599,7 +599,8 @@ class Web(WebMixin, unittest.TestCase): '\s+FILE' '\s+%d' % len(self.BAR_CONTENTS) , res)) - self.failUnless(re.search(r'sub' + # the DIR reference just points to a URI + self.failUnless(re.search(r'sub' '\s+DIR', res)) d.addCallback(_check) @@ -615,7 +616,7 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(lambda res: self.GET(self.public_url, followRedirect=True)) def _check3(res): - self.failUnless(re.search(r'reedownlee' + self.failUnless(re.search(r'reedownlee' '\s+DIR-RO', res)) d.addCallback(_check3) @@ -653,7 +654,8 @@ class Web(WebMixin, unittest.TestCase): d.addCallback(_check) def _done(res): - self.failUnless('%d' % (COUNT-1, COUNT-1) in res) + m = r'' + ("%d" % (COUNT-1)) + r'' + self.failUnless(re.search(m, res)) self.failIf("maximum recursion depth exceeded" in res) d.addCallback(_done) return d diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index d7e98630..dda50a56 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -256,9 +256,8 @@ class Directory(rend.Page): elif IDirectoryNode.providedBy(target): # directory - subdir_url = urllib.quote(name) ctx.fillSlots("filename", - T.a(href=subdir_url)[html.escape(name)]) + T.a(href=uri_link)[html.escape(name)]) if target.is_readonly(): dirtype = "DIR-RO" else: @@ -1296,7 +1295,7 @@ class Root(rend.Page): return rend.NotFound uri = segments[1] d = defer.maybeDeferred(client.create_node_from_uri, uri) - d.addCallback(lambda node: VDrive(node, "from-uri")) + d.addCallback(lambda node: VDrive(node, uri)) d.addCallback(lambda vd: vd.locateChild(ctx, segments[2:])) def _trap_KeyError(f): f.trap(KeyError)