This commit is contained in:
Sergey Obukhov
2016-05-17 15:31:01 -07:00
parent ab6066eafa
commit 44e70939d6
3 changed files with 37 additions and 3 deletions

View File

@@ -175,7 +175,21 @@ def cut_from_block(html_message):
len(maybe_body.getchildren()) == 1)
if not parent_div_is_all_content:
block.getparent().remove(block)
parent = block.getparent()
next_sibling = block.getnext()
# remove all tags after found From block
# (From block and quoted message are in separate divs)
while next_sibling is not None:
parent.remove(block)
block = next_sibling
next_sibling = block.getnext()
# remove the last sibling (or the
# From block if no siblings)
if block is not None:
parent.remove(block)
return True
else:
return False
@@ -200,4 +214,4 @@ def cut_zimbra_quote(html_message):
zDivider = html_message.xpath('//hr[@data-marker="__DIVIDER__"]')
if zDivider:
zDivider[0].getparent().remove(zDivider[0])
return True
return True