In cp_list(), use basestring for ininstance check on the mytree
authorZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 00:41:10 +0000 (17:41 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 10 Aug 2010 00:41:10 +0000 (17:41 -0700)
parameter, and assume it's iterable if it's not a string.

pym/portage/dbapi/porttree.py

index 77c88c85ad40e18e5540c92293009852bb0fd792..b0cd5f49a617371cb4a29d06686b7aa864dbc1a2 100644 (file)
@@ -44,6 +44,7 @@ import sys
 import warnings
 
 if sys.hexversion >= 0x3000000:
+       basestring = str
        long = int
 
 def _src_uri_validate(cpv, eapi, src_uri):
@@ -907,11 +908,12 @@ class portdbapi(dbapi):
                mysplit = mycp.split("/")
                invalid_category = mysplit[0] not in self._categories
                d={}
-               if mytree:
-                       if isinstance(mytree, str):
+               if mytree is not None:
+                       if isinstance(mytree, basestring):
                                mytrees = [mytree]
-                       elif not isinstance(mytree, list):
-                               raise  AssertionError("Invalid input type: %s" %str(type(mytree)))
+                       else:
+                               # assume it's iterable
+                               mytrees = mytree
                else:
                        mytrees = self.porttrees
                for oroot in mytrees: