[PATCH 18/18] python: add try_decrypt argument to Database.index_file()

David Bremner david at tethera.net
Thu Nov 16 05:06:09 PST 2017


Daniel Kahn Gillmor <dkg at fifthhorseman.net> writes:

> @@ -454,10 +487,19 @@ class Database(object):
>                :attr:`STATUS`.READ_ONLY_DATABASE
>                        Database was opened in read-only mode so no message can
>                        be added.
> +

looks like a random blank line

>          """
>          self._assert_db_is_initialized()
>          msg_p = NotmuchMessageP()
> -        status = self._index_file(self._db, _str(filename), c_void_p(None), byref(msg_p))
> +        indexopts = c_void_p(None)
> +        if try_decrypt is not None:
> +            indexopts = self._get_default_indexopts(self._db)
> +            self._indexopts_set_try_decrypt(indexopts, try_decrypt)
> +
> +        status = self._index_file(self._db, _str(filename), indexopts, byref(msg_p))
> +
> +        if indexopts:
> +            self._indexopts_destroy(indexopts)
>  
>          if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:
>              raise NotmuchError(status)
> diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py
> index b1eec2cf..71426c84 100644
> --- a/bindings/python/notmuch/globals.py
> +++ b/bindings/python/notmuch/globals.py
> @@ -88,3 +88,8 @@ NotmuchDirectoryP = POINTER(NotmuchDirectoryS)
>  class NotmuchFilenamesS(Structure):
>      pass
>  NotmuchFilenamesP = POINTER(NotmuchFilenamesS)
> +
> +
> +class NotmuchIndexoptsS(Structure):
> +    pass
> +NotmuchIndexoptsP = POINTER(NotmuchIndexoptsS)
> -- 
> 2.14.2

I think this new bindings functionality needs a test.


More information about the notmuch mailing list