Mercurial > p > roundup > code
diff roundup/roundupdb.py @ 5473:3afda04c96a1
mailer string encoding fixes
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Sun, 29 Jul 2018 01:31:48 +0100 |
| parents | a0ed8d5d744f |
| children | 52cb53eedf77 |
line wrap: on
line diff
--- a/roundup/roundupdb.py Sun Jul 29 00:50:23 2018 +0100 +++ b/roundup/roundupdb.py Sun Jul 29 01:31:48 2018 +0100 @@ -496,7 +496,9 @@ charset = getattr(self.db.config, 'EMAIL_CHARSET', 'utf-8') # construct the content and convert to unicode object - body = s2u('\n'.join(m)).encode(charset) + body = s2u('\n'.join(m)) + if type(body) != type(''): + body = body.encode(charset) # make sure the To line is always the same (for testing mostly) sendto.sort() @@ -588,7 +590,8 @@ values = ', '.join(values) header = "X-Roundup-%s-%s"%(self.classname, propname) try: - message[header] = values.encode('ascii') + values.encode('ascii') + message[header] = values except UnicodeError: message[header] = Header(values, charset)
