Re: [PATCH] python: fix get_property error when property doesn't exist

Subject: Re: [PATCH] python: fix get_property error when property doesn't exist

Date: Fri, 01 Feb 2019 09:45:33 -0400

To: Vincent A, notmuch@notmuchmail.org

Cc:

From: David Bremner


Vincent A <dev@indigo.re> writes:

> In Python bindings, Message.get_property fails with an AttributeError 
> when trying to fetch a property that doesn't exist.

> -        return value.value.decode('utf-8') if value is not None else None
> +        if value is None or value.value is None:
> +            return None
> +        return value.value.decode('utf-8')
>  

Should we be throwing an appropriate exception rather than returning
None? That seems more pythonic to me. In either case we should document
the error handling.

d
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: