patman: Tidy up a few more unicode conversions

Use the new functions in the tools module to handle conversion.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2019-05-14 15:53:54 -06:00
parent e6dca5e8f8
commit f6a6aafceb
2 changed files with 3 additions and 6 deletions

View file

@ -412,9 +412,7 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
if smtp_server: if smtp_server:
cmd.append('--smtp-server=%s' % smtp_server) cmd.append('--smtp-server=%s' % smtp_server)
if in_reply_to: if in_reply_to:
if type(in_reply_to) != str: cmd.append('--in-reply-to="%s"' % tools.FromUnicode(in_reply_to))
in_reply_to = in_reply_to.encode('utf-8')
cmd.append('--in-reply-to="%s"' % in_reply_to)
if thread: if thread:
cmd.append('--thread') cmd.append('--thread')

View file

@ -239,7 +239,7 @@ class Series(dict):
for x in set(cc) & set(settings.bounces): for x in set(cc) & set(settings.bounces):
print(col.Color(col.YELLOW, 'Skipping "%s"' % x)) print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
cc = set(cc) - set(settings.bounces) cc = set(cc) - set(settings.bounces)
cc = [m.encode('utf-8') if type(m) != str else m for m in cc] cc = [tools.FromUnicode(m) for m in cc]
if limit is not None: if limit is not None:
cc = cc[:limit] cc = cc[:limit]
all_ccs += cc all_ccs += cc
@ -248,8 +248,7 @@ class Series(dict):
if cover_fname: if cover_fname:
cover_cc = gitutil.BuildEmailList(self.get('cover_cc', '')) cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
cover_cc = [m.encode('utf-8') if type(m) != str else m cover_cc = [tools.FromUnicode(m) for m in cover_cc]
for m in cover_cc]
cc_list = ', '.join([tools.ToUnicode(x) cc_list = ', '.join([tools.ToUnicode(x)
for x in sorted(set(cover_cc + all_ccs))]) for x in sorted(set(cover_cc + all_ccs))])
print(cover_fname, cc_list.encode('utf-8'), file=fd) print(cover_fname, cc_list.encode('utf-8'), file=fd)