Use basestring instead of str for isinstance check inside use_reduce() so
authorZac Medico <zmedico@gentoo.org>
Thu, 5 Mar 2009 04:43:39 +0000 (04:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 5 Mar 2009 04:43:39 +0000 (04:43 -0000)
that it works with unicode and remove related unicode to str workaround
code from the sqlite cache module.

svn path=/main/trunk/; revision=12757

pym/portage/cache/sqlite.py
pym/portage/dep.py

index 3e287f7ba7e7dd08226accf4037b5b504c027e63..aa5c3046876d4a8c199daaed56a2b95dcb0f22cb 100644 (file)
@@ -163,12 +163,7 @@ class database(fs_template.FsBased):
                        column_index +=1
                        if k not in internal_columns:
                                d[k] = result[0][column_index]
-               # XXX: The resolver chokes on unicode strings so we convert them here.
-               for k in d.keys():
-                       try:
-                               d[k]=str(d[k]) # convert unicode strings to normal
-                       except UnicodeEncodeError, e:
-                               pass #writemsg("%s: %s\n" % (cpv, str(e)))
+
                return d
 
        def _setitem(self, cpv, values):
index 4a9d85e3c38d80344f8132cbc10277709f2492bb..48465ddbed259a2126f002d299f36f7ca11dd957 100644 (file)
@@ -243,7 +243,8 @@ def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]):
                        if head[-1:] == "?": # Use reduce next group on fail.
                                # Pull any other use conditions and the following atom or list into a separate array
                                newdeparray = [head]
-                               while isinstance(newdeparray[-1], str) and newdeparray[-1][-1] == "?":
+                               while isinstance(newdeparray[-1], basestring) and \
+                                       newdeparray[-1][-1:] == "?":
                                        if mydeparray:
                                                newdeparray.append(mydeparray.pop(0))
                                        else: