Merge "Replace basestring with six.string_types"

This commit is contained in:
Zuul 2017-10-16 03:09:59 +00:00 committed by Gerrit Code Review
commit d3d04fbe1d

View File

@ -13,9 +13,12 @@
# under the License. # under the License.
from decorator import decorator from decorator import decorator
import json
import flask import flask
import itertools import itertools
import json import six
from distil.models import Tenant from distil.models import Tenant
from distil import config from distil import config
@ -81,7 +84,7 @@ def validate_tenant_id(tenant_id, session):
"""Tenant ID validation that check that the id you passed is valid, """Tenant ID validation that check that the id you passed is valid,
and that a tenant with this ID exists. and that a tenant with this ID exists.
- returns tenant query, or a tuple if validation failure.""" - returns tenant query, or a tuple if validation failure."""
if isinstance(tenant_id, basestring): if isinstance(tenant_id, six.string_types):
tenant_query = session.query(Tenant).\ tenant_query = session.query(Tenant).\
filter(Tenant.id == tenant_id) filter(Tenant.id == tenant_id)
if tenant_query.count() == 0: if tenant_query.count() == 0: