replace paired logic w/ a call to __init__
This commit is contained in:
parent
9307c3d011
commit
0110cd66cf
@ -311,20 +311,8 @@ class Connection(object): # TODO support auth for pooling
|
||||
"""
|
||||
if right is None:
|
||||
right = (cls.HOST, cls.PORT)
|
||||
|
||||
for param in ('pool_size', 'auto_start_request', 'timeout'):
|
||||
if param in connection_args:
|
||||
warnings.warn("The %s parameter to Connection.paired is "
|
||||
"deprecated" % param, DeprecationWarning)
|
||||
|
||||
if "slave_okay" in connection_args:
|
||||
raise TypeError("cannot specify slave_okay on paired connections")
|
||||
|
||||
connection_args['_connect'] = False
|
||||
|
||||
connection = cls(left[0], left[1], **connection_args)
|
||||
connection.__pair_with(*right)
|
||||
return connection
|
||||
return cls([":".join(map(str, left)), ":".join(map(str, right))],
|
||||
**connection_args)
|
||||
|
||||
def __master(self, sock):
|
||||
"""Is this socket connected to a master server?
|
||||
|
||||
@ -52,7 +52,6 @@ class TestConnection(unittest.TestCase):
|
||||
def test_types(self):
|
||||
self.assertRaises(TypeError, Connection, 1)
|
||||
self.assertRaises(TypeError, Connection, 1.14)
|
||||
self.assertRaises(TypeError, Connection, [])
|
||||
self.assertRaises(TypeError, Connection, "localhost", "27017")
|
||||
self.assertRaises(TypeError, Connection, "localhost", 1.14)
|
||||
self.assertRaises(TypeError, Connection, "localhost", [])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user