diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-05 22:01:43 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-05 22:01:43 +0000 |
commit | 120187eb53f69b015cbbcecd38da0901e3e1cd36 (patch) | |
tree | 37c7b3874a4b1b4eb7fe8ba70a263eca5cbd06da /pym/portage/elog/mod_mail_summary.py | |
parent | 368862a96eb14b285352b9ab936a1b7adabfd740 (diff) | |
download | portage-120187eb53f69b015cbbcecd38da0901e3e1cd36.tar.gz portage-120187eb53f69b015cbbcecd38da0901e3e1cd36.tar.bz2 portage-120187eb53f69b015cbbcecd38da0901e3e1cd36.zip |
Use _unicode_decode() on the string returned from time.strftime(), in order
to avoid a potential UnicodeDecodeError later. Thanks to Markus Duft
<mduft@gentoo.org> for reporting.
svn path=/main/trunk/; revision=14201
Diffstat (limited to 'pym/portage/elog/mod_mail_summary.py')
-rw-r--r-- | pym/portage/elog/mod_mail_summary.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pym/portage/elog/mod_mail_summary.py b/pym/portage/elog/mod_mail_summary.py index adffd4640..e642dc044 100644 --- a/pym/portage/elog/mod_mail_summary.py +++ b/pym/portage/elog/mod_mail_summary.py @@ -8,6 +8,8 @@ from portage.exception import PortageException from portage.localization import _ from portage.util import writemsg from portage import os +from portage import _encodings +from portage import _unicode_decode import socket import time @@ -15,8 +17,11 @@ import time _items = {} def process(mysettings, key, logentries, fulltext): global _items + time_str = _unicode_decode( + time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time())), + encoding=_encodings['content'], errors='replace') header = _(">>> Messages generated for package %(pkg)s by process %(pid)d on %(time)s:\n\n") % \ - {"pkg": key, "pid": os.getpid(), "time": time.strftime("%Y%m%d-%H%M%S %Z", time.localtime(time.time()))} + {"pkg": key, "pid": os.getpid(), "time": time_str} config_root = mysettings["PORTAGE_CONFIGROOT"] mysettings, items = _items.setdefault(config_root, (mysettings, {})) items[key] = header + fulltext |