diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-02 06:55:49 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-02 06:55:49 +0000 |
commit | f78430bc5056c29f195c6464cf54a07da26db997 (patch) | |
tree | 19c98bcc99fa3bb41e9ddd79673e8eac2644ac3f | |
parent | 521e8772c4d7b528f3df9f471cb72b3c4536174d (diff) | |
download | portage-f78430bc5056c29f195c6464cf54a07da26db997.tar.gz portage-f78430bc5056c29f195c6464cf54a07da26db997.tar.bz2 portage-f78430bc5056c29f195c6464cf54a07da26db997.zip |
Bug #295351 - Make update_dbentries() return unicode if it's given unicode,
and bytes if it's given bytes.
svn path=/main/trunk/; revision=14921
-rw-r--r-- | pym/portage/update.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pym/portage/update.py b/pym/portage/update.py index c2f8f3006..04812d5a4 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -63,15 +63,19 @@ def update_dbentries(update_iter, mydata): k_unicode = _unicode_decode(k, encoding=_encodings['repo.content'], errors='replace') if k_unicode not in ignored_dbentries: + orig_content = mycontent mycontent = _unicode_decode(mycontent, encoding=_encodings['repo.content'], errors='replace') + is_encoded = mycontent is not orig_content orig_content = mycontent for update_cmd in update_iter: mycontent = update_dbentry(update_cmd, mycontent) if mycontent != orig_content: - updated_items[k] = _unicode_encode(mycontent, - encoding=_encodings['repo.content'], - errors='backslashreplace') + if is_encoded: + mycontent = _unicode_encode(mycontent, + encoding=_encodings['repo.content'], + errors='backslashreplace') + updated_items[k] = mycontent return updated_items def fixdbentries(update_iter, dbdir): |