]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python/notmuch/database.py
python: document the Database.close function
[notmuch] / bindings / python / notmuch / database.py
index 268e95229bf13f6dfcd81a94177752153a6d0d5d..5c62d4572308dac012e05767578e99850c76016a 100644 (file)
@@ -14,7 +14,7 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with notmuch.  If not, see <http://www.gnu.org/licenses/>.
 
-Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'
+Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>
 """
 
 import os
@@ -56,7 +56,8 @@ class Database(object):
 
     :class:`Database` objects implement the context manager protocol
     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::
 
@@ -189,7 +190,7 @@ class Database(object):
         :raises: :exc:`NotmuchError` in case of any failure
                     (possibly after printing an error message on stderr).
         """
-        if self._db is not None:
+        if self._db:
             raise NotmuchError(message="Cannot create db, this Database() "
                                        "already has an open one.")
 
@@ -225,6 +226,13 @@ class Database(object):
     def close(self):
         '''
         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:
             self._close(self._db)