[yum-commits] Branch 'yum-3_2_X' - 2 commits - output.py yum/sqlitesack.py
James Antill
james at osuosl.org
Thu Nov 20 16:27:16 UTC 2008
output.py | 21 ++++++++++-----------
yum/sqlitesack.py | 6 +++---
2 files changed, 13 insertions(+), 14 deletions(-)
New commits:
commit 7c37027cfb0d1ea2a49ec0b92d743d0d2f3df70c
Author: James Antill <james at and.org>
Date: Thu Nov 20 11:26:04 2008 -0500
Use to_utf8 for changelog data
diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 7ff7d9a..76c9a41 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -34,7 +34,7 @@ import sqlutils
import constants
import operator
import time
-from yum.misc import seq_max_split
+from yum.misc import seq_max_split, to_utf8
def catchSqliteException(func):
"""This decorator converts sqlite exceptions into RepoError"""
@@ -205,8 +205,8 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
# Failure mode is much less of a problem.
for ob in cur:
c_date = ob['date']
- c_author = ob['author'].encode('utf-8', 'replace')
- c_log = ob['changelog'].encode('utf-8', 'replace')
+ c_author = to_utf8(ob['author'])
+ c_log = to_utf8(ob['changelog'])
result.append((c_date, _share_data(c_author), c_log))
self._changelog = result
return
commit 6f58a52cb569810ae2057dc3588f0be3a4108e8e
Author: James Antill <james at and.org>
Date: Thu Nov 20 11:06:03 2008 -0500
Deal with utf8 in licenses! Given it's there just shoot everything with it
diff --git a/output.py b/output.py
index d2c2ec5..a5504c9 100755
--- a/output.py
+++ b/output.py
@@ -443,8 +443,7 @@ class YumOutput:
def _enc(self, s):
"""Get the translated version from specspo and ensure that
it's actually encoded in UTF-8."""
- if type(s) == unicode:
- s = s.encode("UTF-8")
+ s = to_utf8(s)
if len(s) > 0:
for d in self.i18ndomains:
t = gettext.dgettext(d, s)
@@ -455,24 +454,24 @@ class YumOutput:
def infoOutput(self, pkg, highlight=False):
(hibeg, hiend) = self._highlight(highlight)
- print _("Name : %s%s%s") % (hibeg, pkg.name, hiend)
- print _("Arch : %s") % pkg.arch
+ print _("Name : %s%s%s") % (hibeg, to_unicode(pkg.name), hiend)
+ print _("Arch : %s") % to_unicode(pkg.arch)
if pkg.epoch != "0":
- print _("Epoch : %s") % pkg.epoch
- print _("Version : %s") % pkg.version
- print _("Release : %s") % pkg.release
+ print _("Epoch : %s") % to_unicode(pkg.epoch)
+ print _("Version : %s") % to_unicode(pkg.version)
+ print _("Release : %s") % to_unicode(pkg.release)
print _("Size : %s") % self.format_number(float(pkg.size))
- print _("Repo : %s") % pkg.repoid
+ print _("Repo : %s") % to_unicode(pkg.repoid)
if self.verbose_logger.isEnabledFor(logginglevels.DEBUG_3):
- print _("Committer : %s") % pkg.committer
+ print _("Committer : %s") % to_unicode(pkg.committer)
print _("Committime : %s") % time.ctime(pkg.committime)
print _("Buildtime : %s") % time.ctime(pkg.buildtime)
if hasattr(pkg, 'installtime'):
print _("Installtime: %s") % time.ctime(pkg.installtime)
print self.fmtKeyValFill(_("Summary : "), self._enc(pkg.summary))
if pkg.url:
- print _("URL : %s") % pkg.url
- print _("License : %s") % pkg.license
+ print _("URL : %s") % to_unicode(pkg.url)
+ print _("License : %s") % to_unicode(pkg.license)
print self.fmtKeyValFill(_("Description: "), self._enc(pkg.description))
print ""
More information about the Yum-commits
mailing list