use isinstance instead of type

This commit is contained in:
Andreas Preikschat 2013-06-16 21:42:50 +02:00
parent 1aeb9bef2f
commit bb7bbdf10c
2 changed files with 3 additions and 3 deletions

View File

@ -473,7 +473,7 @@ class ImageMediaItem(MediaManagerItem):
This boolean is set to True when the list in the interface should be reloaded after saving the new images
"""
for filename in images_list:
if type(filename) is not str and type(filename) is not unicode:
if not isinstance(filename, basestring):
continue
log.debug(u'Adding new image: %s', filename)
imageFile = ImageFilenames()

View File

@ -98,9 +98,9 @@ OPTIONAL_MODULES = [
w = sys.stdout.write
def check_vers(version, required, text):
if type(version) is not str:
if not isinstance(version, str):
version = '.'.join(map(str, version))
if type(required) is not str:
if not isinstance(required, str):
required = '.'.join(map(str, required))
w(' %s >= %s ... ' % (text, required))
if LooseVersion(version) >= LooseVersion(required):