From a3a8cf2d79caff581cc062c316d0f85cf70d46fb Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Thu, 5 Aug 2010 10:04:37 -0400 Subject: [PATCH] BUMP 1.8 - see changelog for details --- doc/changelog.rst | 46 ++++++++++++++++++++++++++++++++++++++++++- gridfs/__init__.py | 2 +- pymongo/__init__.py | 2 +- pymongo/bson.py | 2 +- pymongo/collection.py | 12 +++++------ pymongo/connection.py | 12 +++++------ pymongo/dbref.py | 2 +- pymongo/errors.py | 4 ++-- pymongo/json_util.py | 4 ++-- pymongo/objectid.py | 4 ++-- pymongo/timestamp.py | 2 +- setup.py | 2 +- 12 files changed, 69 insertions(+), 25 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 7eba391c8..e922ed32b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,10 +1,54 @@ Changelog ========= +Changes in Version 1.8 +---------------------- + +Version 1.8 adds support for connecting to replica sets, specifying +per-operation values for `w` and `wtimeout`, and decoding to +timezone-aware datetimes. + +- fixed a reference leak in the C extension when decoding a + :class:`~pymongo.dbref.DBRef`. +- added support for `w`, `wtimeout`, and `fsync` (and any other + options for `getLastError`) to "safe mode" operations. +- added :attr:`~pymongo.connection.Connection.nodes` property. +- added a maximum pool size of 10 sockets. +- added support for replica sets. +- DEPRECATED :meth:`~pymongo.connection.Connection.from_uri` and + :meth:`~pymongo.connection.Connection.paired`, both are supplanted + by extended functionality in :meth:`~pymongo.connection.Connection`. +- added tz aware support for datetimes in + :class:`~pymongo.objectid.ObjectId`, + :class:`~pymongo.timestamp.Timestamp` and :mod:`~pymongo.json_util` + methods. +- added :meth:`~pymongo.collection.Collection.drop` helper. +- reuse the socket used for finding the master when a + :class:`~pymongo.connection.Connection` is first created. +- added support for :class:`~pymongo.min_key.MinKey`, + :class:`~pymongo.max_key.MaxKey` and + :class:`~pymongo.timestamp.Timestamp` to :mod:`~pymongo.json_util`. +- added support for decoding datetimes as aware (UTC) - it is highly + recommended to enable this by setting the `tz_aware` parameter to + :meth:`~pymongo.connection.Connection` to ``True``. +- added `network_timeout` option for individual calls to + :meth:`~pymongo.collection.Collection.find` and + :meth:`~pymongo.collection.Collection.find_one`. +- added :meth:`~gridfs.GridFS.exists` to check if a file exists in + GridFS. +- added support for additional keys in :class:`~pymongo.dbref.DBRef` + instances. +- added :attr:`~pymongo.errors.OperationFailure.code` attribute to + :class:`~pymongo.errors.OperationFailure` exceptions. +- fixed serialization of int and float subclasses in the C extension. + Changes in Version 1.7 ---------------------- -Version 1.7 is a recommended upgrade for all PyMongo users. The full release notes are below, and some more in depth discussion of the highlights is `here `_. +Version 1.7 is a recommended upgrade for all PyMongo users. The full +release notes are below, and some more in depth discussion of the +highlights is `here +`_. - no longer attempt to build the C extension on big-endian systems. - added :class:`~pymongo.min_key.MinKey` and diff --git a/gridfs/__init__.py b/gridfs/__init__.py index dbec83ff9..3d8df025e 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -212,7 +212,7 @@ class GridFS(object): - `**kwargs` (optional): keyword arguments are used as a query document, if they're present. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 """ if kwargs: return self.__files.find_one(kwargs) is not None diff --git a/pymongo/__init__.py b/pymongo/__init__.py index f54724dae..277b2f85f 100644 --- a/pymongo/__init__.py +++ b/pymongo/__init__.py @@ -39,7 +39,7 @@ ALL = 2 """Profile all operations.""" # Remember to change in setup.py as well! -version = "1.7+" +version = "1.8" """Current version of PyMongo.""" Connection = PyMongo_Connection diff --git a/pymongo/bson.py b/pymongo/bson.py index caddc88f1..cd30448b7 100644 --- a/pymongo/bson.py +++ b/pymongo/bson.py @@ -459,7 +459,7 @@ class BSON(str): - `tz_aware` (optional): if ``True``, return timezone-aware :class:`~datetime.datetime` instances - .. versionadded:: 1.7+ + .. versionadded:: 1.8 The `tz_aware` parameter. .. versionadded:: 1.7 The `as_class` parameter. diff --git a/pymongo/collection.py b/pymongo/collection.py index ed8bde753..576fb1718 100644 --- a/pymongo/collection.py +++ b/pymongo/collection.py @@ -195,7 +195,7 @@ class Collection(object): ``safe=True``, and will be used as options for the `getLastError` command - .. versionadded:: 1.7+ + .. versionadded:: 1.8 Support for passing `getLastError` options as keyword arguments. @@ -246,7 +246,7 @@ class Collection(object): ``safe=True``, and will be used as options for the `getLastError` command - .. versionadded:: 1.7+ + .. versionadded:: 1.8 Support for passing `getLastError` options as keyword arguments. .. versionchanged:: 1.1 @@ -333,7 +333,7 @@ class Collection(object): ``safe=True``, and will be used as options for the `getLastError` command - .. versionadded:: 1.7+ + .. versionadded:: 1.8 Support for passing `getLastError` options as keyword arguments. .. versionchanged:: 1.4 @@ -370,7 +370,7 @@ class Collection(object): >>> db.foo.drop() >>> db.drop_collection("foo") - .. versionadded:: 1.7+ + .. versionadded:: 1.8 """ self.__database.drop_collection(self.__name) @@ -408,7 +408,7 @@ class Collection(object): ``safe=True``, and will be used as options for the `getLastError` command - .. versionadded:: 1.7+ + .. versionadded:: 1.8 Support for passing `getLastError` options as keyword arguments. .. versionchanged:: 1.7 Accept any type other than a ``dict`` instance for removal @@ -536,7 +536,7 @@ class Collection(object): .. note:: The `max_scan` parameter requires server version **>= 1.5.1** - .. versionadded:: 1.7+ + .. versionadded:: 1.8 The `network_timeout` parameter. .. versionadded:: 1.7 diff --git a/pymongo/connection.py b/pymongo/connection.py index 307abe141..3507abaf1 100644 --- a/pymongo/connection.py +++ b/pymongo/connection.py @@ -215,12 +215,12 @@ class Connection(object): # TODO support auth for pooling aware (otherwise they will be naive) .. seealso:: :meth:`end_request` - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 The `host` parameter can now be a full `mongodb URI `_, in addition to a simple hostname. It can also be a list of hostnames or URIs. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 The `tz_aware` parameter. .. versionadded:: 1.7 The `document_class` parameter. @@ -299,7 +299,7 @@ class Connection(object): # TODO support auth for pooling def from_uri(cls, uri="mongodb://localhost", **connection_args): """DEPRECATED Can pass a mongodb URI directly to Connection() instead. - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 DEPRECATED .. versionadded:: 1.5 """ @@ -311,7 +311,7 @@ class Connection(object): # TODO support auth for pooling def paired(cls, left, right=None, **connection_args): """DEPRECATED Can pass a list of hostnames to Connection() instead. - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 DEPRECATED """ warnings.warn("Connection.paired is deprecated - can pass multiple " @@ -403,7 +403,7 @@ class Connection(object): # TODO support auth for pooling created, as well as nodes discovered through the replica set discovery mechanism. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 """ return self.__nodes @@ -432,7 +432,7 @@ class Connection(object): # TODO support auth for pooling See the `tz_aware` parameter to :meth:`Connection`. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 """ return self.__tz_aware diff --git a/pymongo/dbref.py b/pymongo/dbref.py index da202b9c4..d6c15c527 100644 --- a/pymongo/dbref.py +++ b/pymongo/dbref.py @@ -37,7 +37,7 @@ class DBRef(object): - `**kwargs` (optional): additional keyword arguments will create additional, custom fields - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 Now takes keyword arguments to specify additional fields. .. versionadded:: 1.1.1 The `database` parameter. diff --git a/pymongo/errors.py b/pymongo/errors.py index 07bd9a3a8..05b7c83e0 100644 --- a/pymongo/errors.py +++ b/pymongo/errors.py @@ -47,7 +47,7 @@ class ConfigurationError(PyMongoError): class OperationFailure(PyMongoError): """Raised when a database operation fails. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 The :attr:`code` attribute. """ @@ -59,7 +59,7 @@ class OperationFailure(PyMongoError): class TimeoutError(OperationFailure): """Raised when a database operation times out. - .. versionadded:: 1.7+ + .. versionadded:: 1.8 """ diff --git a/pymongo/json_util.py b/pymongo/json_util.py index 91e68ea84..4910b8343 100644 --- a/pymongo/json_util.py +++ b/pymongo/json_util.py @@ -34,11 +34,11 @@ Currently this does not handle special encoding and decoding for :class:`~pymongo.binary.Binary` and :class:`~pymongo.code.Code` instances. -.. versionchanged:: 1.7+ +.. versionchanged:: 1.8 Handle timezone aware datetime instances on encode, decode to timezone aware datetime instances. -.. versionchanged:: 1.7+ +.. versionchanged:: 1.8 Added support for encoding/decoding :class:`~pymongo.max_key.MaxKey` and :class:`~pymongo.min_key.MinKey`, and for encoding diff --git a/pymongo/objectid.py b/pymongo/objectid.py index 7e0270002..b480288f8 100644 --- a/pymongo/objectid.py +++ b/pymongo/objectid.py @@ -103,7 +103,7 @@ class ObjectId(object): - `generation_time`: :class:`~datetime.datetime` to be used as the generation time for the resulting ObjectId. - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 Properly handle timezone aware values for `generation_time`. @@ -177,7 +177,7 @@ class ObjectId(object): represents the generation time in UTC. It is precise to the second. - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 Now return an aware datetime instead of a naive one. .. versionadded:: 1.2 diff --git a/pymongo/timestamp.py b/pymongo/timestamp.py index 67c7e9723..fe9fb0273 100644 --- a/pymongo/timestamp.py +++ b/pymongo/timestamp.py @@ -87,7 +87,7 @@ class Timestamp(object): """Return a :class:`~datetime.datetime` instance corresponding to the time portion of this :class:`Timestamp`. - .. versionchanged:: 1.7+ + .. versionchanged:: 1.8 The returned datetime is now timezone aware. """ return datetime.datetime.fromtimestamp(self.__time, utc) diff --git a/setup.py b/setup.py index 7da154f04..a41c50de3 100755 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils.core import Extension # Remember to change in pymongo/__init__.py as well! -version = "1.7+" +version = "1.8" f = open("README.rst") try: