[PATCH] python: add bindings for notmuch_message_get_propert(y/ies)

David Bremner david at tethera.net
Sat Dec 23 07:59:51 PST 2017


Ruben Pollan <meskio at sindominio.net> writes:
> +
> +    def get_properties(self, prop="", exact=False):

As far as I understand, you also need to update docs/source/message.rst
so that your new methods are documented in the sphinx docs.

> +        """ Get the properties for *message*, returning
> +        notmuch_message_properties_t object which can be used to iterate
> +        over all properties.

This seeems to be wrong (or at last confusing) for the python bindings.

> +
> +        :param prop: The name of the property to get. Otherwise it will return
> +                     the full list of properties of the message.
> +        :param exact: if True, require exact match with key. Otherwise
> +                      treat as prefix.
> +        :returns: A dictionary with the property names and values {key: value}
> +        :raises: :exc:`NotInitializedError` if message has not been
> +                 initialized
> +        """
> +        if not self._msg:
> +            raise NotInitializedError()
> +
> +        properties_dict = {}
> +        properties = Message._get_properties(self._msg, prop, exact)

Now that the database.get_configs method is merged, I'd prefer to be consistent
with that, and define a generator that yields key/value pairs. It's easy
enough for someone to use a dictionary comprehension to get a dict from
that if they want it.  Sorry to be making extra work for you.

d


More information about the notmuch mailing list