]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
cli: webopen: when called with no arguments, open the Welcome page
authorBrian Warner <warner@lothar.com>
Wed, 1 Jul 2009 20:05:48 +0000 (13:05 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 1 Jul 2009 20:05:48 +0000 (13:05 -0700)
src/allmydata/scripts/cli.py
src/allmydata/scripts/tahoe_webopen.py
src/allmydata/test/test_cli.py

index 56365fb6c907638388528f642a189c6a4d13d759..69d96c8d94bb7ecf1933c4cb88c7f71ad9870a05 100644 (file)
@@ -300,7 +300,7 @@ class WebopenOptions(VDriveOptions):
     def getSynopsis(self):
         return "%s webopen [ALIAS:PATH]" % (os.path.basename(sys.argv[0]),)
 
-    longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive."""
+    longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive. When called without arguments, opens to the Welcome page."""
 
 class ManifestOptions(VDriveOptions):
     optFlags = [
index 6470bb4051daa633ccb236d4cb9b40f972777a97..b4e13c1482a89e3f713f21f7cbd780b1a183ea39 100644 (file)
@@ -7,12 +7,15 @@ def webopen(options, opener=None):
     if not nodeurl.endswith("/"):
         nodeurl += "/"
     where = options.where
-    rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
-    if path == '/':
-        path = ''
-    url = nodeurl + "uri/%s" % urllib.quote(rootcap)
-    if path:
-        url += "/" + escape_path(path)
+    if where:
+        rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
+        if path == '/':
+            path = ''
+        url = nodeurl + "uri/%s" % urllib.quote(rootcap)
+        if path:
+            url += "/" + escape_path(path)
+    else:
+        url = nodeurl
     if not opener:
         import webbrowser
         opener = webbrowser.open
index f990ebb3c4e3e03a96f28478234ea7e9ca11d494..8b46502d9c2a32a40f6c22158503485534e9f059 100644 (file)
@@ -474,6 +474,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
             aliases = get_aliases(self.get_clientdir())
             node_url_file = os.path.join(self.get_clientdir(), "node.url")
             nodeurl = open(node_url_file, "r").read().strip()
+            self.welcome_url = nodeurl
             uribase = nodeurl + "uri/"
             self.tahoe_url = uribase + urllib.quote(aliases["tahoe"])
             self.tahoe_subdir_url = self.tahoe_url + "/subdir"
@@ -505,7 +506,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
         d.addCallback(_check_add_duplicate)
 
         def _test_urls(junk):
-            self._test_webopen([], self.tahoe_url)
+            self._test_webopen([], self.welcome_url)
             self._test_webopen(["/"], self.tahoe_url)
             self._test_webopen(["tahoe:"], self.tahoe_url)
             self._test_webopen(["tahoe:/"], self.tahoe_url)