summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-04 21:12:22 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-04 21:12:22 +0000
commitd95a0f4df52eb025a181df90faf07d67de45d761 (patch)
tree52335fdd46d0bdfade8eeef0e4e8495b389e5423
parent6f4c36f6e0103ea54ee0a2c03bad81bfb7c8442d (diff)
downloadportage-d95a0f4df52eb025a181df90faf07d67de45d761.tar.gz
portage-d95a0f4df52eb025a181df90faf07d67de45d761.tar.bz2
portage-d95a0f4df52eb025a181df90faf07d67de45d761.zip
Always return unicode from vardbapi.aux_get().
svn path=/main/trunk/; revision=13907
-rw-r--r--pym/portage/dbapi/vartree.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index e759a9b15..72c829271 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1173,6 +1173,12 @@ class vardbapi(dbapi):
cache_mtime, metadata = pkg_data
cache_valid = cache_mtime == mydir_mtime
if cache_valid:
+ for k, v in metadata.iteritems():
+ if not isinstance(v, unicode):
+ # Migrate old metadata to unicode.
+ metadata[k] = unicode(v,
+ encoding='utf_8', errors='replace')
+
mydata.update(metadata)
pull_me.difference_update(mydata)
@@ -1193,7 +1199,7 @@ class vardbapi(dbapi):
if not mydata['SLOT']:
# Empty slot triggers InvalidAtom exceptions when generating slot
# atoms for packages, so translate it to '0' here.
- mydata['SLOT'] = '0'
+ mydata['SLOT'] = u'0'
return [mydata[x] for x in wants]
def _aux_get(self, mycpv, wants, st=None):
@@ -1216,7 +1222,8 @@ class vardbapi(dbapi):
results.append(long(st.st_mtime))
continue
try:
- myf = open(os.path.join(mydir, x), "r")
+ myf = codecs.open(os.path.join(mydir, x),
+ mode='r', encoding='utf_8', errors='replace')
try:
myd = myf.read()
finally: