Add a temporary workaround for bug #263081 (partially reverts r12757).
authorZac Medico <zmedico@gentoo.org>
Mon, 23 Mar 2009 02:19:36 +0000 (02:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 23 Mar 2009 02:19:36 +0000 (02:19 -0000)
(trunk r13141)

svn path=/main/branches/2.1.6/; revision=13158

pym/portage/cache/sqlite.py

index aa5c3046876d4a8c199daaed56a2b95dcb0f22cb..6588b3cc748b02c91b66e2f107e32d9bd4321c9b 100644 (file)
@@ -164,6 +164,18 @@ class database(fs_template.FsBased):
                        if k not in internal_columns:
                                d[k] = result[0][column_index]
 
+               # As a temporary workaround for bug #263081, convert unicode strings
+               # to raw byte strings. This helps to potential unicode errors that can
+               # be triggered elsewhere when attempting to join unicode strings with
+               # raw byte strings. TODO: Convert all string handling code to use
+               # unicode strings instead of raw byte strings (required for py3k
+               # compatibility).
+               for k, v in d.iteritems():
+                       try:
+                               d[k] = str(v)
+                       except UnicodeEncodeError:
+                               pass
+
                return d
 
        def _setitem(self, cpv, values):