compare instance to basestring instead of (str, unicode)

This commit is contained in:
Christophe Benz 2010-08-17 19:33:06 +02:00
commit 8afff42465
9 changed files with 13 additions and 13 deletions

View file

@ -284,7 +284,7 @@ class ConsoleApplication(BaseApplication):
if caps is not None:
if not isinstance(caps, (list, tuple, set)):
caps = (caps,)
caps = [(cap if isinstance(cap, (str,unicode)) else cap.__name__) for cap in caps]
caps = [(cap if isinstance(cap, basestring) else cap.__name__) for cap in caps]
weboobcfg.command_backends(*caps)
logging.error(u'You can configure backends using the "weboob-config add" command:\nweboob-config add <name> [options..]')
with open('/dev/null', 'w') as devnull:

View file

@ -188,7 +188,7 @@ class BaseBackend(object):
def has_caps(self, *caps):
for c in caps:
if (isinstance(c, (unicode,str)) and c in [cap.__name__ for cap in self.iter_caps()]) or \
if (isinstance(c, basestring) and c in [cap.__name__ for cap in self.iter_caps()]) or \
isinstance(self, c):
return True
return False

View file

@ -224,7 +224,7 @@ class BaseBrowser(mechanize.Browser):
def check_location(func):
def inner(self, *args, **kwargs):
if args and isinstance(args[0], (str,unicode)) and args[0][0] == '/' and \
if args and isinstance(args[0], basestring) and args[0][0] == '/' and \
(not self.request or self.request.host != self.DOMAIN):
args = ('%s://%s%s' % (self.PROTOCOL, self.DOMAIN, args[0]),) + args[1:]