From 49a0eae8052e32ee371dbbf9eaa9c03b34148f39 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 18 Nov 2015 16:22:38 +0100 Subject: [PATCH] [FIX] mail: mails fetch `node.get('class', '')` returns a `Nonetype` in some cases, and, therefore, `'o_mail_notification' in node.get('class', '')` throws a `TypeError: argument of type 'NoneType' is not iterable`. Replacing by `(node.get('class') or '')` keep the behavior that was expected, but will prevent to have a `Nonetype` opw-656508 opw-656753 opw-653965 --- addons/mail/models/mail_thread.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 6e9efec571e..eb87211d3da 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1239,7 +1239,7 @@ class MailThread(models.AbstractModel): root = lxml.html.fromstring(body) postprocessed = False for node in root.iter(): - if 'o_mail_notification' in node.get('class', '') or 'o_mail_notification' in node.get('summary', ''): + if 'o_mail_notification' in (node.get('class') or '') or 'o_mail_notification' in (node.get('summary') or ''): postprocessed = True node.getparent().remove(node) if postprocessed: