doc improvements

This commit is contained in:
Mike Dirolf 2010-03-26 16:45:47 -04:00
parent a384561087
commit 0baad44c7e
4 changed files with 20 additions and 5 deletions

View File

@ -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:

View File

@ -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

View File

@ -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+
"""

View File

@ -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)