[FIX] Fixed previous commit, car go to len of the string.

bzr revid: tde@openerp.com-20131023123839-gvf9ugft2b2xmo9a
This commit is contained in:
Thibault Delavallée 2013-10-23 14:38:39 +02:00
parent 7f61d18ef9
commit e14de7a637
1 changed files with 2 additions and 2 deletions

View File

@ -200,8 +200,8 @@ def html_email_clean(html, remove=False, shorten=False, max_length=300):
truncate_idx = node.text.find(word) + len(word)
else:
truncate_idx = position
if truncate_idx == -1 or truncate_idx >= len(node.text):
truncate_idx = len(node.text) - 1
if truncate_idx == -1 or truncate_idx > len(node.text):
truncate_idx = len(node.text)
# compose new text bits
innertext = node.text[0:truncate_idx]