Continue with quotation cut even if html cut throws an exception

This commit is contained in:
Derrick J. Wippler
2020-01-30 11:51:33 -06:00
parent c575beb27d
commit 3083f86c75
4 changed files with 17 additions and 11 deletions

View File

@@ -464,6 +464,8 @@ def _extract_from_html(msg_body):
if html_tree is None:
return msg_body
cut_quotations = False
try:
cut_quotations = (html_quotations.cut_gmail_quote(html_tree) or
html_quotations.cut_zimbra_quote(html_tree) or
html_quotations.cut_blockquote(html_tree) or
@@ -471,6 +473,10 @@ def _extract_from_html(msg_body):
html_quotations.cut_by_id(html_tree) or
html_quotations.cut_from_block(html_tree)
)
except Exception as e:
log.exception('during html quotations cut')
pass
html_tree_copy = deepcopy(html_tree)
number_of_checkpoints = html_quotations.add_checkpoint(html_tree, 0)

View File

@@ -62,7 +62,7 @@ RE_SIGNATURE_CANDIDATE = re.compile(r'''
def extract_signature(msg_body):
'''
"""
Analyzes message for a presence of signature block (by common patterns)
and returns tuple with two elements: message text without signature block
and the signature itself.
@@ -72,7 +72,7 @@ def extract_signature(msg_body):
>>> extract_signature('Hey man!')
('Hey man!', None)
'''
"""
try:
# identify line delimiter first
delimiter = get_delimiter(msg_body)

View File

@@ -2,7 +2,7 @@
from __future__ import absolute_import
from .fixtures import REPLY_QUOTATIONS_SHARE_BLOCK, OLK_SRC_BODY_SECTION, REPLY_SEPARATED_BY_HR
from tests.fixtures import REPLY_QUOTATIONS_SHARE_BLOCK, OLK_SRC_BODY_SECTION, REPLY_SEPARATED_BY_HR
from nose.tools import eq_, ok_, assert_false, assert_true
from talon import quotations, utils as u
from mock import Mock, patch

View File

@@ -2,7 +2,7 @@
from __future__ import absolute_import
from .fixtures import STANDARD_REPLIES
from tests.fixtures import STANDARD_REPLIES
from talon import quotations
from six.moves import range
from nose.tools import eq_