Continue with quotation cut even if html cut throws an exception
This commit is contained in:
@@ -464,13 +464,19 @@ def _extract_from_html(msg_body):
|
||||
if html_tree is None:
|
||||
return msg_body
|
||||
|
||||
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
|
||||
html_quotations.cut_microsoft_quote(html_tree) or
|
||||
html_quotations.cut_by_id(html_tree) or
|
||||
html_quotations.cut_from_block(html_tree)
|
||||
)
|
||||
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
|
||||
html_quotations.cut_microsoft_quote(html_tree) or
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user