From fd58bfea4874ef364d172bcb5dfe788452c06a1c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 9 Aug 2010 17:41:10 -0700 Subject: [PATCH] In cp_list(), use basestring for ininstance check on the mytree parameter, and assume it's iterable if it's not a string. --- pym/portage/dbapi/porttree.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 77c88c85a..b0cd5f49a 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -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: -- 2.26.2