If only one host is provided try to connect to just that node and fail otherwise. Previously if the single host was part of a replica set we would try to find the set's primary based on other hosts returned by an 'ismaster' query. We make a direct connection to a single host even if it's a secondary in a replica set. slaveok is no longer considered when making a connection. If multiple hosts are provided we still try to find a master/primary and fail if we can't.
This change adds a new module common.py with some common functions and classes used in a number of pymongo modules. The most important of these is the BaseObject class. This provides a new base class that Connection, Database, and Collection inherit from. The class provides attributes common to each of these subclasses including slave_okay, safe and getlasterror options. With this change you can now set slaveok, safe, w, wtimeout, fsync and j at the Connection, Database, Collection or per- operation level. Each level inherits from and can override the previous. All of these options are now supported as keyword parameters to connection.Connection and in the mongodb URI.
This change moves the URI parsing code out of pymongo.connection and into a new module, pymongo.uri_parser. It also adds validation for all MongoDB URI options currently supported by pymongo as well as some that will be supported in pymongo-2.0. an UnsupportedOption error (inheriting from ConfigurationError) is raised if the URI includes an option pymongo doesn't support or recognize. The primary entry point for uri_parser is uri_parser.parse_uri which returns a dict of the results from parsing the URI. See the documentation for more details
The default exception (which we use) for decode failures is UnicodeError or a subclass of it. This fixes a unittest that forces RuntimeError. We shouldn't use blanket except blocks either way.