From 57c11338ae23c8389da6c4969e897e7b95b782bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 22 Oct 2013 16:29:08 +0200 Subject: [PATCH] [IMP] tools: mail: added a protection in a string.find, could have a None argument bzr revid: tde@openerp.com-20131022142908-sol44xaprx1b0b0a --- openerp/tools/mail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index 2e84f0b4420..6ab7119236c 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -195,7 +195,10 @@ def html_email_clean(html, remove=False, shorten=False, max_length=300): cur_char_nbr += len(word) if cur_char_nbr >= position: break - stop_idx = node.text.find(word) + len(word) + if word: + stop_idx = node.text.find(word) + len(word) + else: + stop_idx = len(node.text) if stop_idx == -1: stop_idx = len(node.text) else: