s/basestring/string_types

This commit is contained in:
j 2016-09-07 14:56:09 +02:00
parent 0b80bebf15
commit 8dbe22b6ea

View file

@ -10,6 +10,7 @@ import hashlib
import base64 import base64
import binascii import binascii
from six import string_types
from django.db import models from django.db import models
from django.conf import settings from django.conf import settings
import ox import ox
@ -36,7 +37,7 @@ def find(info, guess=True):
else: else:
for key in Imdb.keys: for key in Imdb.keys:
if key in info and info[key]: if key in info and info[key]:
if isinstance(info[key], basestring): if isinstance(info[key], string_types):
fkey = '%s__iexact'%key fkey = '%s__iexact'%key
else: else:
fkey = key fkey = key
@ -118,7 +119,7 @@ class Imdb(models.Model):
value = info[key] value = info[key]
if isinstance(value, list): if isinstance(value, list):
value = u'\n'.join(value) + '\n' value = u'\n'.join(value) + '\n'
if isinstance(value, basestring): if isinstance(value, string_types):
value = normalize_value(value) value = normalize_value(value)
setattr(self, key, value) setattr(self, key, value)
if self.season < 0: if self.season < 0:
@ -227,7 +228,7 @@ class Imdb(models.Model):
for key in list(j): for key in list(j):
if not j[key]: if not j[key]:
del j[key] del j[key]
if 'year' in j and isinstance(j['year'], basestring) and j['year'].isdigit(): if 'year' in j and isinstance(j['year'], string_types) and j['year'].isdigit():
j['year'] = int(j['year']) j['year'] = int(j['year'])
return j return j