Skip to content

Commit

Permalink
MongoDB: This code was not reached
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Nov 21, 2015
1 parent 914453d commit c694a0a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions celery/backends/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
from pymongo.errors import InvalidDocument # noqa
else: # pragma: no cover
Binary = None # noqa
InvalidDocument = None # noqa

class InvalidDocument(Exception): # noqa
pass

__all__ = ['MongoBackend']

Expand Down Expand Up @@ -83,6 +85,9 @@ def __init__(self, app=None, url=None, **kwargs):

# update conf with mongo uri data, only if uri was given
if self.url:
if self.url == 'mongodb://':
self.url += 'localhost'

uri_data = pymongo.uri_parser.parse_uri(self.url)
# build the hosts list to create a mongo connection
hostslist = [
Expand Down Expand Up @@ -149,10 +154,6 @@ def _get_connection(self):
if isinstance(host, string_t) \
and not host.startswith('mongodb://'):
host = 'mongodb://{0}:{1}'.format(host, self.port)

if host == 'mongodb://':
host += 'localhost'

# don't change self.options
conf = dict(self.options)
conf['host'] = host
Expand Down

0 comments on commit c694a0a

Please sign in to comment.