diff --git a/doc/api/gridfs/grid_file.rst b/doc/api/gridfs/grid_file.rst index 497319115..0186c2c31 100644 --- a/doc/api/gridfs/grid_file.rst +++ b/doc/api/gridfs/grid_file.rst @@ -4,7 +4,15 @@ .. automodule:: gridfs.grid_file :synopsis: Tools for representing files stored in GridFS - .. autoclass:: GridFile(file-spec, database[, mode='r'[, collection='fs']]) + .. autoclass:: GridIn :members: .. autoattribute:: _id + + .. autoclass:: GridOut + :members: + + .. autoattribute:: _id + + .. autoclass:: GridFile(file-spec, database[, mode='r'[, collection='fs']]) + :members: diff --git a/gridfs/__init__.py b/gridfs/__init__.py index b781c849c..9fcba2af4 100644 --- a/gridfs/__init__.py +++ b/gridfs/__init__.py @@ -103,7 +103,7 @@ class GridFS(object): """Get a file from GridFS by ``"_id"``. Returns an instance of :class:`~gridfs.grid_file.GridOut`, - which provides a file-like interface. + which provides a file-like interface for reading. :Parameters: - `file_id`: ``"_id"`` of the file to get diff --git a/gridfs/errors.py b/gridfs/errors.py index 3eae534de..848798b77 100644 --- a/gridfs/errors.py +++ b/gridfs/errors.py @@ -40,9 +40,9 @@ class UnsupportedAPI(GridFSError): In version 1.5.1+ 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 (no deprecation - period). This exception will be raised when attempting to use - unsupported constructs from the old API. + 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.1+ """ diff --git a/gridfs/grid_file.py b/gridfs/grid_file.py index e6f53e42e..63ff097d7 100644 --- a/gridfs/grid_file.py +++ b/gridfs/grid_file.py @@ -53,6 +53,13 @@ def _create_property(field_name, docstring, field_name) self.__file[field_name] = value + if read_only: + docstring = docstring + "\n\nThis attribute is read-only.""" + elif not closed_only: + docstring = docstring + "\n\nThis attribute can only be set before :meth:`close` has been called.""" + else: + docstring = docstring + "\n\nThis attribute is read-only and can only be read after :meth:`close` has been called.""" + if not read_only and not closed_only: return property(getter, setter, doc=docstring) return property(getter, doc=docstring)