diff --git a/talon/quotations.py b/talon/quotations.py index 99eec95..e41c46a 100644 --- a/talon/quotations.py +++ b/talon/quotations.py @@ -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) diff --git a/talon/signature/bruteforce.py b/talon/signature/bruteforce.py index e502bab..68cf6c0 100644 --- a/talon/signature/bruteforce.py +++ b/talon/signature/bruteforce.py @@ -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) diff --git a/tests/html_quotations_test.py b/tests/html_quotations_test.py index bdf8c6b..6ca866d 100644 --- a/tests/html_quotations_test.py +++ b/tests/html_quotations_test.py @@ -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 diff --git a/tests/text_quotations_test.py b/tests/text_quotations_test.py index f431c1e..1c354b0 100644 --- a/tests/text_quotations_test.py +++ b/tests/text_quotations_test.py @@ -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_