diff --git a/doc/api/gridfs/grid_file.rst b/doc/api/gridfs/grid_file.rst index 5daa82a90..59f4d03f5 100644 --- a/doc/api/gridfs/grid_file.rst +++ b/doc/api/gridfs/grid_file.rst @@ -15,8 +15,5 @@ .. autoattribute:: _id .. automethod:: __iter__ - .. autoclass:: GridFile - :members: - .. autoclass:: GridOutCursor :members: diff --git a/doc/changelog.rst b/doc/changelog.rst index 02a29244d..0813af802 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -59,6 +59,13 @@ from ``_conn_id`` to ``address``. :meth:`~pymongo.MongoClient.set_cursor_manager` is no longer deprecated. +:mod:`~gridfs` Changes +...................... + +Since PyMongo 1.6, methods ``open`` and ``close`` of :class:`~gridfs.GridFS` +raised an ``UnsupportedAPI`` exception, as did the entire ``GridFile`` class. +The unsupported methods, the class, and the exception are all deleted. + Issues Resolved ............... diff --git a/gridfs/__init__.py b/gridfs/__init__.py index 28bda4373..6b1b9faa8 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -20,8 +20,7 @@ The :mod:`gridfs` package is an implementation of GridFS on top of .. mongodoc:: gridfs """ -from gridfs.errors import (NoFile, - UnsupportedAPI) +from gridfs.errors import NoFile from gridfs.grid_file import (GridIn, GridOut, GridOutCursor) @@ -376,20 +375,3 @@ class GridFS(object): if kwargs: return self.__files.find_one(kwargs, ["_id"]) is not None return self.__files.find_one(document_or_id, ["_id"]) is not None - - def open(self, *args, **kwargs): - """No longer supported. - - .. versionchanged:: 1.6 - The open method is no longer supported. - """ - raise UnsupportedAPI("The open method is no longer supported.") - - def remove(self, *args, **kwargs): - """No longer supported. - - .. versionchanged:: 1.6 - The remove method is no longer supported. - """ - raise UnsupportedAPI("The remove method is no longer supported. " - "Please use the delete method instead.") diff --git a/gridfs/errors.py b/gridfs/errors.py index 1e2717fa3..7e94a600d 100644 --- a/gridfs/errors.py +++ b/gridfs/errors.py @@ -31,13 +31,3 @@ class NoFile(GridFSError): class FileExists(GridFSError): """Raised when trying to create a file that already exists.""" - - -class UnsupportedAPI(GridFSError): - """Raised when trying to use the old GridFS API. - - 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.""" diff --git a/gridfs/grid_file.py b/gridfs/grid_file.py index 33c5dd197..69e6d6fc0 100644 --- a/gridfs/grid_file.py +++ b/gridfs/grid_file.py @@ -23,8 +23,7 @@ from bson.objectid import ObjectId from bson.py3compat import text_type, StringIO from gridfs.errors import (CorruptGridFile, FileExists, - NoFile, - UnsupportedAPI) + NoFile) from pymongo import ASCENDING from pymongo.collection import Collection from pymongo.cursor import Cursor @@ -612,17 +611,6 @@ class GridOutIterator(object): __next__ = next -class GridFile(object): - """No longer supported. - - .. versionchanged:: 1.6 - The GridFile class is no longer supported. - """ - def __init__(self, *args, **kwargs): - raise UnsupportedAPI("The GridFile class is no longer supported. " - "Please use GridIn or GridOut instead.") - - class GridOutCursor(Cursor): """A cursor / iterator for returning GridOut objects as the result of an arbitrary query against the GridFS files collection.