replace paired logic w/ a call to __init__

This commit is contained in:
Mike Dirolf 2010-07-09 17:19:18 -04:00
parent 9307c3d011
commit 0110cd66cf
2 changed files with 2 additions and 15 deletions

View File

@ -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?

View File

@ -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", [])