source file: /home/buildslave/tahoe/edgy/build/src/allmydata/scripts/tahoe_webopen.py
file stats: 20 lines, 17 executed: 85.0% covered
coverage versus previous test: 0 lines added, 0 lines removed
1.
2. from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path
3. import urllib
4.
5. def webopen(options, opener=None):
6. nodeurl = options['node-url']
7. if not nodeurl.endswith("/"):
8. nodeurl += "/"
9. where = options.where
10. if where:
11. rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
12. if path == '/':
13. path = ''
14. url = nodeurl + "uri/%s" % urllib.quote(rootcap)
15. if path:
16. url += "/" + escape_path(path)
17. else:
18. url = nodeurl
19. if not opener:
20. import webbrowser
21. opener = webbrowser.open
22. opener(url)
23. return 0
24.