Commit 04bcb621 authored by Helga Velroyen's avatar Helga Velroyen
Browse files

gnt-job list: deal with non-ascii encoding in jobs



This fixes issue 432. If a job summary contained a non-ascii character,
gnt-job list crashed badly so far. This patch fixes the crash and makes
gnt-job list display unicode characters properly.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 7d60c3b5
......@@ -60,9 +60,16 @@ def _FormatStatus(value):
raise errors.ProgrammerError("Unknown job status code '%s'" % value)
def _FormatSummary(value):
"""Formats a job's summary. Takes possible non-ascii encoding into account.
"""
return ','.encode('utf-8').join(item.encode('utf-8') for item in value)
_JOB_LIST_FORMAT = {
"status": (_FormatStatus, False),
"summary": (lambda value: ",".join(str(item) for item in value), False),
"summary": (_FormatSummary, False),
}
_JOB_LIST_FORMAT.update(dict.fromkeys(["opstart", "opexec", "opend"],
(lambda value: map(FormatTimestamp,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment