summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-21 00:23:44 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-21 00:23:44 +0000
commit3c40a733c8713c2db2debe18e1a638fc23296571 (patch)
tree72a31c787d2d062f509e2bf60b91ca4a9b0a6678 /pym
parent9fa866297d1e01e658580b410c1a1e53fccd775f (diff)
downloadportage-3c40a733c8713c2db2debe18e1a638fc23296571.tar.gz
portage-3c40a733c8713c2db2debe18e1a638fc23296571.tar.bz2
portage-3c40a733c8713c2db2debe18e1a638fc23296571.zip
Use _encodings where appropriate.
svn path=/main/trunk/; revision=14108
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/bintree.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index ed5e44430..322487c31 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -21,6 +21,7 @@ from portage.localization import _
from portage import dep_expand, listdir, _check_distfile, _movefile
from portage import os
+from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
@@ -74,7 +75,8 @@ class bindbapi(fakedbapi):
def getitem(k):
v = tbz2.getfile(k)
if v is not None:
- v = _unicode_decode(v)
+ v = _unicode_decode(v,
+ encoding=_encodings['repo.content'], errors='replace')
return v
else:
getitem = self.bintree._remotepkgs[mycpv].get
@@ -109,8 +111,10 @@ class bindbapi(fakedbapi):
mydata = mytbz2.get_data()
for k, v in values.iteritems():
- k = _unicode_encode(k)
- v = _unicode_encode(v)
+ k = _unicode_encode(k,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
+ v = _unicode_encode(v,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
mydata[k] = v
for k, v in mydata.items():
@@ -652,8 +656,10 @@ class binarytree(object):
urldata[1] + urldata[2], "Packages")
pkgindex = self._new_pkgindex()
try:
- f = codecs.open(_unicode_encode(pkgindex_file),
- encoding='utf_8', errors='replace')
+ f = codecs.open(_unicode_encode(pkgindex_file,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'],
+ errors='replace')
try:
pkgindex.read(f)
finally:
@@ -1094,8 +1100,10 @@ class binarytree(object):
def _load_pkgindex(self):
pkgindex = self._new_pkgindex()
try:
- f = codecs.open(_unicode_encode(self._pkgindex_file),
- encoding='utf_8', errors='replace')
+ f = codecs.open(_unicode_encode(self._pkgindex_file,
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'],
+ errors='replace')
except EnvironmentError:
pass
else: