Skip to content

Commit

Permalink
parse_url function should not know about mongodb, and the transport a…
Browse files Browse the repository at this point in the history
…lready sets can_parse_url
  • Loading branch information
ask committed May 20, 2014
1 parent 4b26895 commit df3fa3c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
4 changes: 0 additions & 4 deletions kombu/tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ def test_parse_url(self):
result = parse_url(self.url)
self.assertDictEqual(result, self.expected)

def test_parse_url_mongodb(self):
result = parse_url('mongodb://example.com/')
self.assertEqual(result['hostname'], 'example.com/')

def test_parse_generated_as_uri(self):
conn = Connection(self.url)
info = conn.info()
Expand Down
10 changes: 1 addition & 9 deletions kombu/utils/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,9 @@ def _parse_url(url):
schemeless = url[len(scheme) + 3:]
# parse with HTTP URL semantics
parts = urlparse('http://' + schemeless)

# The first pymongo.Connection() argument (host) can be
# a mongodb connection URI. If this is the case, don't
# use port but let pymongo get the port(s) from the URI instead.
# This enables the use of replica sets and sharding.
# See pymongo.Connection() for more info.
port = scheme != 'mongodb' and parts.port or None
hostname = schemeless if scheme == 'mongodb' else parts.hostname
path = parts.path or ''
path = path[1:] if path and path[0] == '/' else path
return (scheme, unquote(hostname or '') or None, port,
return (scheme, unquote(parts.hostname or '') or None, parts.port,
unquote(parts.username or '') or None,
unquote(parts.password or '') or None,
unquote(path or '') or None,
Expand Down

0 comments on commit df3fa3c

Please sign in to comment.