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):
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)
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