Revision 3c1e7bef

b/snf-common/synnefo/lib/__init__.py
34 34
from urlparse import urlparse
35 35

  
36 36

  
37
def join_urls(a, b):
37
def join_urls(*args):
38 38
    """
39
    Join arguments into a url.
40

  
39 41
    >>> join_urls("http://www.test.org", "path")
40 42
    'http://www.test.org/path'
41 43
    >>> join_urls("http://www.test.org/", "path")
......
56 58
    'http://www.test.org/a/b/c/d'
57 59

  
58 60
    """
59
    return a.rstrip("/") + "/" + b.lstrip("/")
61
    return "/".join([a.lstrip("/").rstrip("/") for a in args[:-1]]) + \
62
            "/" + args[-1].lstrip("/")
60 63

  
61 64

  
62 65
def parse_base_url(base_url):

Also available in: Unified diff