def cut_yahoo_quote(html_message): ''' Cuts the outermost block element with class yahoo_quoted. ''' yahoo_quote = cssselect('div.yahoo_quoted', html_message) if yahoo_quote and (yahoo_quote[0].text is None or not RE_FWD.match(yahoo_quote[0].text)): yahoo_quote[0].getparent().remove(yahoo_quote[0]) return True
def cut_gmail_quote(html_message): ''' Cuts the outermost block element with class gmail_quote. ''' gmail_quote = cssselect('div.gmail_quote', html_message) if gmail_quote and (gmail_quote[0].text is None or not RE_FWD.match(gmail_quote[0].text)): gmail_quote[0].getparent().remove(gmail_quote[0]) return True
def cut_by_id(html_message): found = False for quote_id in QUOTE_IDS: quote = cssselect('#{}'.format(quote_id), html_message) if quote: found = True quote[0].getparent().remove(quote[0]) return found
def cut_by_id(html_message): found = False for quote_id in QUOTE_IDS: quote = cssselect('#{}'.format(quote_id), html_message) if quote: found = True quote[0].getparent().remove(quote[0]) return found
def cut_gmail_extra(html_message): print("test12") gmail_quote = cssselect('div.gmail_extra', html_message) print("test") if gmail_quote and (gmail_quote[0].text is None or not RE_FWD.match(gmail_quote[0].text)): print("test") gmail_quote[0].getparent().remove(gmail_quote[0]) return True
def cut_gmail_quote(html_message): ''' Cuts the outermost block element with class gmail_quote. ''' gmail_quote = cssselect('div.gmail_quote', html_message) if gmail_quote and (gmail_quote[0].text is None or not RE_FWD.match(gmail_quote[0].text)): gmail_quote[0].getparent().remove(gmail_quote[0]) return True
def cut_yahoo_quoted(html_message): gmail_quote = cssselect('div.yahoo_quoted', html_message) if gmail_quote and (gmail_quote[0].text is None): gmail_quote[0].getparent().remove(gmail_quote[0]) return True