unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] add notmuch.Database.get_status_string()
@ 2015-12-10  2:12 Daniel Kahn Gillmor
  2015-12-10  2:16 ` [PATCH v2] " Daniel Kahn Gillmor
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kahn Gillmor @ 2015-12-10  2:12 UTC (permalink / raw)
  To: Notmuch Mail

This gives some additional access to debugging information when using
the python bindings.
---
 bindings/python/notmuch/database.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 5b58e09..5f80267 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -114,6 +114,11 @@ class Database(object):
     _get_all_tags.argtypes = [NotmuchDatabaseP]
     _get_all_tags.restype = NotmuchTagsP
 
+    """notmuch_database_status_string"""
+    _get_status_string = nmlib.notmuch_database_status_string
+    _get_status_string.argtypes = [NotmuchDatabaseP]
+    _get_status_string.restype = c_char_p
+
     """notmuch_database_create"""
     _create = nmlib.notmuch_database_create
     _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]
@@ -575,6 +580,14 @@ class Database(object):
         """
         return Query(self, querystring)
 
+    def get_status_string(self):
+        """Returns the status string of the database
+
+        This is sometimes used for additional error reporting
+        """
+        self._assert_db_is_initialized()
+        return Database._get_status_string(self._db).decode('utf-8', 'ignore')
+
     def __repr__(self):
         return "'Notmuch DB " + self.get_path() + "'"
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] add notmuch.Database.get_status_string()
  2015-12-10  2:12 [PATCH] add notmuch.Database.get_status_string() Daniel Kahn Gillmor
@ 2015-12-10  2:16 ` Daniel Kahn Gillmor
  2015-12-10  2:18   ` Daniel Kahn Gillmor
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kahn Gillmor @ 2015-12-10  2:16 UTC (permalink / raw)
  To: Notmuch Mail

This gives some additional access to debugging information when using
the python bindings.
---
 bindings/python/notmuch/database.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
index 5b58e09..d29c292 100644
--- a/bindings/python/notmuch/database.py
+++ b/bindings/python/notmuch/database.py
@@ -114,6 +114,11 @@ class Database(object):
     _get_all_tags.argtypes = [NotmuchDatabaseP]
     _get_all_tags.restype = NotmuchTagsP
 
+    """notmuch_database_status_string"""
+    _get_status_string = nmlib.notmuch_database_status_string
+    _get_status_string.argtypes = [NotmuchDatabaseP]
+    _get_status_string.restype = c_char_p
+
     """notmuch_database_create"""
     _create = nmlib.notmuch_database_create
     _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]
@@ -575,6 +580,17 @@ class Database(object):
         """
         return Query(self, querystring)
 
+    def get_status_string(self):
+        """Returns the status string of the database
+
+        This is sometimes used for additional error reporting
+        """
+        self._assert_db_is_initialized()
+        s = Database._get_status_string(self._db)
+        if s:
+            return s.decode('utf-8', 'ignore')
+        return s
+
     def __repr__(self):
         return "'Notmuch DB " + self.get_path() + "'"
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] add notmuch.Database.get_status_string()
  2015-12-10  2:16 ` [PATCH v2] " Daniel Kahn Gillmor
@ 2015-12-10  2:18   ` Daniel Kahn Gillmor
  2015-12-11 16:15     ` Justus Winter
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Kahn Gillmor @ 2015-12-10  2:18 UTC (permalink / raw)
  To: Notmuch Mail

Sorry about the first version, which didn't handle a NULL value
properly.  Please only consider this v2 version.

           --dkg

On Wed 2015-12-09 21:16:40 -0500, Daniel Kahn Gillmor wrote:
> This gives some additional access to debugging information when using
> the python bindings.
> ---
>  bindings/python/notmuch/database.py | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py
> index 5b58e09..d29c292 100644
> --- a/bindings/python/notmuch/database.py
> +++ b/bindings/python/notmuch/database.py
> @@ -114,6 +114,11 @@ class Database(object):
>      _get_all_tags.argtypes = [NotmuchDatabaseP]
>      _get_all_tags.restype = NotmuchTagsP
>  
> +    """notmuch_database_status_string"""
> +    _get_status_string = nmlib.notmuch_database_status_string
> +    _get_status_string.argtypes = [NotmuchDatabaseP]
> +    _get_status_string.restype = c_char_p
> +
>      """notmuch_database_create"""
>      _create = nmlib.notmuch_database_create
>      _create.argtypes = [c_char_p, POINTER(NotmuchDatabaseP)]
> @@ -575,6 +580,17 @@ class Database(object):
>          """
>          return Query(self, querystring)
>  
> +    def get_status_string(self):
> +        """Returns the status string of the database
> +
> +        This is sometimes used for additional error reporting
> +        """
> +        self._assert_db_is_initialized()
> +        s = Database._get_status_string(self._db)
> +        if s:
> +            return s.decode('utf-8', 'ignore')
> +        return s
> +
>      def __repr__(self):
>          return "'Notmuch DB " + self.get_path() + "'"
>  
> -- 
> 2.6.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] add notmuch.Database.get_status_string()
  2015-12-10  2:18   ` Daniel Kahn Gillmor
@ 2015-12-11 16:15     ` Justus Winter
  0 siblings, 0 replies; 4+ messages in thread
From: Justus Winter @ 2015-12-11 16:15 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

Quoting Daniel Kahn Gillmor (2015-12-10 03:18:17)
> Sorry about the first version, which didn't handle a NULL value
> properly.  Please only consider this v2 version.

Applied, thanks.  I changed it slightly to conform with our naming
scheme.

Justus

[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAABCAAGBQJWavaVAAoJENMeiILK3jZYCWEP/2YvoyGREElEknsV+/nQ8QXs
yH4fcOVaTq8bSo+mwwc7oWF0bXMHJ5JRp9oiZxhJ4QgCWPIoqBhRGr6+jD2rBM8E
caEosQ0soElBpp4us3wiGXb9PzKUSp+SsISe7e1tIvkmRrIVhdVJZ5cocvgv1XZ4
npDZm3QS2BVk+ePBTzSakKglmi9l5biVzBHqtcBKg8ChOVMJktXkMkfcZxn4Sv3O
L+QeDn7kJnOp4DPgVYdGdTAD2+Qhy5P+jIFw3NQOvuaNuN87dLIfhSel2LuEK/y5
lMv5de6VeAAvK+loA3tUMGYcVplEtEQilIUMJS09CNmfNxa4ezHcl+mWmZO6Mtym
9jT7VW3ne6yYTxwtGH0D2FcR8zcHYBzr1shuD2v9+QLjgNu8CLQZHcHQxX4bGExL
Tff9Q7zYa0hOtpphb7PKeDF6BIfStU1siVsCuklqf9age5ZRR2sA/AQ14kCJ8PON
xPjOZQxr5sXgpC7IjL13EdLyJ/sn3uRNG1fb8quZCAffgjNw4r6yvawkUfB3UOjR
r8OMhxjGJ77XpsiqOqDSfvZbFcwM4ux5g4Vo+uiNlWD5HZYzLCuxwzk6Aj3NJ+mi
j0X0OQ6uqiTC/jwbcMmECXOkwrX/lK153xlHhfCj9LQx4Qoqr3rYJIvbmDW7zauG
tq/C9GmAkSblMeBDCdXF
=TiaI
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-11 16:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-10  2:12 [PATCH] add notmuch.Database.get_status_string() Daniel Kahn Gillmor
2015-12-10  2:16 ` [PATCH v2] " Daniel Kahn Gillmor
2015-12-10  2:18   ` Daniel Kahn Gillmor
2015-12-11 16:15     ` Justus Winter

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).