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

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

Date: Sat, 23 Dec 2017 11:59:51 -0400

To: Ruben Pollan, notmuch@notmuchmail.org

Cc:

From: David Bremner


Ruben Pollan <meskio@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
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: