mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
python: fix get_property error when property doesn't exist
In Python bindings, Message.get_property fails with an AttributeError when trying to fetch a property that doesn't exist. From d712832ba982085975c27b23bb502af82e638b39 Mon Sep 17 00:00:00 2001 From: hydrargyrum <dev@indigo.re> Date: Sun, 6 Jan 2019 16:08:55 +0100 Subject: [PATCH] python: fix get_property error when property doesn't exist
This commit is contained in:
parent
adde6dfaef
commit
872bd134e3
1 changed files with 3 additions and 1 deletions
|
@ -482,7 +482,9 @@ class Message(Python3StringMixIn):
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise NotmuchError(status)
|
raise NotmuchError(status)
|
||||||
|
|
||||||
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')
|
||||||
|
|
||||||
def get_properties(self, prop="", exact=False):
|
def get_properties(self, prop="", exact=False):
|
||||||
""" Get the properties of the message, returning a generator of
|
""" Get the properties of the message, returning a generator of
|
||||||
|
|
Loading…
Add table
Reference in a new issue