[projects/pld-builder.new] - fixed mail encoding errors
hawk
hawk at pld-linux.org
Mon May 10 18:02:36 CEST 2021
commit 149a8bcbb65a9d5465c48827fec76b396ee0864e
Author: Marcin Krol <hawk at tld-linux.org>
Date: Mon May 10 18:02:13 2021 +0200
- fixed mail encoding errors
PLD_Builder/mailer.py | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/PLD_Builder/mailer.py b/PLD_Builder/mailer.py
index 7d90091..a9f2c8f 100644
--- a/PLD_Builder/mailer.py
+++ b/PLD_Builder/mailer.py
@@ -7,12 +7,7 @@ from io import StringIO
from config import config
import shutil
import log
-
-def recode(s):
- if s.__class__ == ''.__class__:
- return s.encode('iso-8859-1', 'replace').decode('us-ascii', 'replace')
- else:
- return s.decode('us-ascii', 'replace')
+import util
class Message:
def __init__(self):
@@ -36,10 +31,10 @@ class Message:
del self.headers[n]
def write_line(self, l):
- self.body.write(recode("%s\n" % l))
+ self.body.write(util.to_str("%s\n" % l))
def write(self, s):
- self.body.write(recode(s))
+ self.body.write(util.to_str(s))
def append_log(self, log):
s = os.stat(log)
@@ -53,7 +48,7 @@ class Message:
line = 0
for l in f:
if line < 100 or line > line_cnt - 100:
- self.body.write(recode(l))
+ self.body.write(util.to_str(l))
if line == line_cnt - 100:
self.body.write("\n\n[...]\n\n")
line += 1
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/149a8bcbb65a9d5465c48827fec76b396ee0864e
More information about the pld-cvs-commit
mailing list