From f2029b175c23b224465a99b9caee8acfdf4dd2cb Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Wed, 14 Apr 2010 17:14:34 -0400 Subject: [PATCH] BUMP 1.6 -- see changelog for details --- doc/changelog.rst | 27 +++++++++++++++++++++++++++ doc/examples/gridfs.rst | 8 ++++++++ gridfs/__init__.py | 18 +++++++++--------- gridfs/errors.py | 6 +++--- gridfs/grid_file.py | 2 +- pymongo/__init__.py | 2 +- pymongo/database.py | 2 +- pymongo/objectid.py | 2 +- 8 files changed, 51 insertions(+), 16 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index e57c6b0ab..f1ed48045 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,6 +1,33 @@ Changelog ========= +Changes in Version 1.6 +---------------------- + +The biggest change in version 1.6 is a complete re-implementation of +:mod:`gridfs` with a lot of improvements over the old +implementation. There are many details and examples of using the new +API in `this blog post +`_. The +old API has been removed in this version, so existing code will need +to be modified before upgrading to 1.6. + +- fixed issue where connection pool was being shared across + :class:`~pymongo.connection.Connection` instances. +- more improvements to Python code caching in C extension - should + improve behavior on mod_wsgi. +- added :meth:`~pymongo.objectid.ObjectId.from_datetime`. +- complete rewrite of :mod:`gridfs` support. +- improvements to the :meth:`~pymongo.database.Database.command` API. +- fixed :meth:`~pymongo.collection.Collection.drop_indexes` behavior + on non-existent collections. +- disallow empty bulk inserts. + +Changes in Version 1.5.2 +------------------------ +- fixed response handling to ignore unknown response flags in queries. +- handle server versions containing '-pre-'. + Changes in Version 1.5.1 ------------------------ - added :data:`~gridfs.grid_file.GridFile._id` property for diff --git a/doc/examples/gridfs.rst b/doc/examples/gridfs.rst index 0a0d0ed07..03c1d031d 100644 --- a/doc/examples/gridfs.rst +++ b/doc/examples/gridfs.rst @@ -1,6 +1,14 @@ GridFS Example ============== +.. warning:: + + This example is out of date, and documents the API for GridFS in + PyMongo versions < 1.6. If you are using a version of PyMongo that + is >= 1.6 please see `this blog post + `_ + for an overview of how the new API works. + .. testsetup:: from pymongo import Connection diff --git a/gridfs/__init__.py b/gridfs/__init__.py index fa1f9d44b..25eac1f3d 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -41,7 +41,7 @@ class GridFS(object): - `database`: database to use - `collection` (optional): root collection to use - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 The `collection` parameter. .. mongodoc:: gridfs @@ -66,7 +66,7 @@ class GridFS(object): :Parameters: - `**kwargs` (optional): keyword arguments for file creation - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ return GridIn(self.__collection, **kwargs) @@ -91,7 +91,7 @@ class GridFS(object): - `data`: data to be written as a file. - `**kwargs` (optional): keyword arguments for file creation - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ grid_file = GridIn(self.__collection, **kwargs) try: @@ -109,7 +109,7 @@ class GridFS(object): :Parameters: - `file_id`: ``"_id"`` of the file to get - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ return GridOut(self.__collection, file_id) @@ -128,7 +128,7 @@ class GridFS(object): :Parameters: - `filename`: ``"filename"`` of the file to get - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ self.__files.ensure_index([("filename", ASCENDING), ("uploadDate", DESCENDING)]) @@ -156,7 +156,7 @@ class GridFS(object): :Parameters: - `file_id`: ``"_id"`` of the file to delete - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ self.__files.remove({"_id": file_id}, safe=True) self.__chunks.remove({"files_id": file_id}) @@ -165,7 +165,7 @@ class GridFS(object): """List the names of all files stored in this instance of :class:`GridFS`. - .. versionchanged:: 1.5.2+ + .. versionchanged:: 1.6 Removed the `collection` argument. """ return self.__files.distinct("filename") @@ -173,7 +173,7 @@ class GridFS(object): def open(self, *args, **kwargs): """No longer supported. - .. versionchanged:: 1.5.2+ + .. versionchanged:: 1.6 The open method is no longer supported. """ raise UnsupportedAPI("The open method is no longer supported.") @@ -181,7 +181,7 @@ class GridFS(object): def remove(self, *args, **kwargs): """No longer supported. - .. versionchanged:: 1.5.2+ + .. versionchanged:: 1.6 The remove method is no longer supported. """ raise UnsupportedAPI("The remove method is no longer supported. " diff --git a/gridfs/errors.py b/gridfs/errors.py index 627e41e69..895ce7b08 100644 --- a/gridfs/errors.py +++ b/gridfs/errors.py @@ -32,17 +32,17 @@ class CorruptGridFile(GridFSError): class NoFile(GridFSError): """Raised when trying to read from a non-existent file. - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ class UnsupportedAPI(GridFSError): """Raised when trying to use the old GridFS API. - In version 1.5.2+ of the PyMongo distribution there were backwards + In version 1.6 of the PyMongo distribution there were backwards incompatible changes to the GridFS API. Upgrading shouldn't be difficult, but the old API is no longer supported (with no deprecation period). This exception will be raised when attempting to use unsupported constructs from the old API. - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ diff --git a/gridfs/grid_file.py b/gridfs/grid_file.py index 434d7f51e..0737a2a6a 100644 --- a/gridfs/grid_file.py +++ b/gridfs/grid_file.py @@ -434,7 +434,7 @@ class GridOutIterator(object): class GridFile(object): """No longer supported. - .. versionchanged:: 1.5.2+ + .. versionchanged:: 1.6 The GridFile class is no longer supported. """ def __init__(self, *args, **kwargs): diff --git a/pymongo/__init__.py b/pymongo/__init__.py index bb1fc45ea..31cba99f4 100644 --- a/pymongo/__init__.py +++ b/pymongo/__init__.py @@ -38,7 +38,7 @@ SLOW_ONLY = 1 ALL = 2 """Profile all operations.""" -version = "1.5.2+" +version = "1.6" """Current version of PyMongo.""" Connection = PyMongo_Connection diff --git a/pymongo/database.py b/pymongo/database.py index 2a46a1a26..46a6d4001 100644 --- a/pymongo/database.py +++ b/pymongo/database.py @@ -280,7 +280,7 @@ class Database(object): - `**kwargs` (optional): additional keyword arguments will be added to the command document before it is sent - .. versionchanged:: 1.5.2+ + .. versionchanged:: 1.6 Added the `value` argument for string commands, and keyword arguments for additional command options. .. versionchanged:: 1.5 diff --git a/pymongo/objectid.py b/pymongo/objectid.py index eacc15009..ab7ff826e 100644 --- a/pymongo/objectid.py +++ b/pymongo/objectid.py @@ -105,7 +105,7 @@ class ObjectId(object): - `generation_time`: :class:`~datetime.datetime` to be used as the generation time for the resulting ObjectId. - .. versionadded:: 1.5.2+ + .. versionadded:: 1.6 """ ts = calendar.timegm(generation_time.timetuple()) oid = struct.pack(">i", int(ts)) + "\x00" * 8