[PATCH v2] add notmuch.Database.get_status_string()

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Dec 9 18:18:17 PST 2015


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 at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list