Remove GridFS.open and close, and GridFile.
This commit is contained in:
parent
936ee264cb
commit
9143e187d3
@ -15,8 +15,5 @@
|
||||
.. autoattribute:: _id
|
||||
.. automethod:: __iter__
|
||||
|
||||
.. autoclass:: GridFile
|
||||
:members:
|
||||
|
||||
.. autoclass:: GridOutCursor
|
||||
:members:
|
||||
|
||||
@ -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
|
||||
...............
|
||||
|
||||
|
||||
@ -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.")
|
||||
|
||||
@ -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."""
|
||||
|
||||
@ -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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user