mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 20:08:10 +01:00
python: document the Database.close function
Put a prominent warning into the docstring of Database.close, make the function show up in the sphinx doc and refer to the warning in the paragraph mentioning the context manager protocol. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
e9bcbe7e70
commit
ca1e232e5f
2 changed files with 11 additions and 1 deletions
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
.. automethod:: open(path, status=MODE.READ_ONLY)
|
.. automethod:: open(path, status=MODE.READ_ONLY)
|
||||||
|
|
||||||
|
.. automethod:: close
|
||||||
|
|
||||||
.. automethod:: get_path
|
.. automethod:: get_path
|
||||||
|
|
||||||
.. automethod:: get_version
|
.. automethod:: get_version
|
||||||
|
|
|
@ -56,7 +56,8 @@ class Database(object):
|
||||||
|
|
||||||
:class:`Database` objects implement the context manager protocol
|
:class:`Database` objects implement the context manager protocol
|
||||||
so you can use the :keyword:`with` statement to ensure that the
|
so you can use the :keyword:`with` statement to ensure that the
|
||||||
database is properly closed.
|
database is properly closed. See :meth:`close` for more
|
||||||
|
information.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
@ -225,6 +226,13 @@ class Database(object):
|
||||||
def close(self):
|
def close(self):
|
||||||
'''
|
'''
|
||||||
Closes the notmuch database.
|
Closes the notmuch database.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
This function closes the notmuch database. From that point
|
||||||
|
on every method invoked on any object ever derived from
|
||||||
|
the closed database may cease to function and raise a
|
||||||
|
NotmuchError.
|
||||||
'''
|
'''
|
||||||
if self._db:
|
if self._db:
|
||||||
self._close(self._db)
|
self._close(self._db)
|
||||||
|
|
Loading…
Reference in a new issue