You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2020/08/18 07:22:55 UTC
[incubator-ponymail-foal] 01/02: switch to .assign,
don't muck about with internals externally
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 0c96a2447f3f568f5ca1d7e524884781a3e7ee9a
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Aug 18 09:20:13 2020 +0200
switch to .assign, don't muck about with internals externally
Also wipe unneeded variable
---
tools/archiver.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/archiver.py b/tools/archiver.py
index 755dfeb..a238979 100755
--- a/tools/archiver.py
+++ b/tools/archiver.py
@@ -187,6 +187,9 @@ class Body:
def __len__(self):
return len(self.string or "")
+ def assign(self, new_string):
+ self.string = new_string
+
def encode(self, charset="utf-8", errors="strict"):
return self.string.encode(charset, errors=errors)
@@ -287,9 +290,8 @@ class Archiver(object): # N.B. Also used by import-mbox.py
or len(body) <= 1
or (ignore_body and str(body).find(str(ignore_body)) != -1)
):
- content_type = "text/html"
body = first_html
- body.string = self.html2text(body.string)
+ body.assign(self.html2text(str(body)))
return body
def format_flowed(self, body, msg_metadata):