diff options
Diffstat (limited to 'obalie/utils.py')
-rw-r--r-- | obalie/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/obalie/utils.py b/obalie/utils.py index dcf476a..2d4be0e 100644 --- a/obalie/utils.py +++ b/obalie/utils.py | |||
@@ -9,6 +9,7 @@ Miscellaneous Utility Commands | |||
9 | 9 | ||
10 | 10 | ||
11 | import shlex | 11 | import shlex |
12 | from urlparse import urljoin | ||
12 | from subprocess import Popen, PIPE | 13 | from subprocess import Popen, PIPE |
13 | from obalie.exceptions import ExecutableError | 14 | from obalie.exceptions import ExecutableError |
14 | 15 | ||
@@ -30,3 +31,12 @@ def run_command(command, raw_output=False): | |||
30 | return stdout | 31 | return stdout |
31 | else: | 32 | else: |
32 | return stdout.splitlines(True) | 33 | return stdout.splitlines(True) |
34 | |||
35 | |||
36 | def join_url(base, path): | ||
37 | """ | ||
38 | Joins a URL but ignores the leading slash on the path that would | ||
39 | otherwise truncate the base part back to the hostname. | ||
40 | """ | ||
41 | path = path.lstrip('/') | ||
42 | return urljoin(base, path) | ||