Skip to content

Commit 1d81aea

Browse files
Sergey Ninuabehackett
authored andcommitted
allow connect option to be passed as string
1 parent ddbd2dd commit 1d81aea

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pymongo/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ def validate_ok_for_update(update):
439439
'document_class': validate_document_class,
440440
'tz_aware': validate_boolean_or_string,
441441
'uuidrepresentation': validate_uuid_representation,
442-
'connect': validate_boolean,
442+
'connect': validate_boolean_or_string,
443443
'event_listeners': _validate_event_listeners
444444
}
445445

test/test_uri_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def test_split_options(self):
9797
self.assertRaises(ConfigurationError, split_options, 'foo')
9898
self.assertRaises(ConfigurationError, split_options, 'foo=bar;foo')
9999
self.assertTrue(split_options('ssl=true'))
100+
self.assertTrue(split_options('connect=true'))
100101
self.assertTrue(split_options('ssl_match_hostname=true'))
101102

102103
# Test Invalid URI options that should throw warnings.
@@ -118,6 +119,8 @@ def test_split_options(self):
118119
'connectTimeoutMS=-1e100000', warn=True)
119120
self.assertRaises(Warning, split_options,
120121
'ssl=foo', warn=True)
122+
self.assertRaises(Warning, split_options,
123+
'connect=foo', warn=True)
121124
self.assertRaises(Warning, split_options,
122125
'ssl_match_hostname=foo', warn=True)
123126

@@ -153,6 +156,7 @@ def test_split_options(self):
153156
self.assertRaises(ValueError, split_options,
154157
'connectTimeoutMS=-1e100000')
155158
self.assertRaises(ValueError, split_options, 'ssl=foo')
159+
self.assertRaises(ValueError, split_options, 'connect=foo')
156160
self.assertRaises(ValueError, split_options, 'ssl_match_hostname=foo')
157161
if not (sys.platform == "win32" and sys.version_info <= (2, 5)):
158162
self.assertRaises(ValueError, split_options,

0 commit comments

Comments
 (0)