py34: fix basestring usage in validator
Change-Id: Ia8ab9435e5eda29d2ff429152a06e5c77ab2a0e4
This commit is contained in:
parent
7a04b3a5ac
commit
0cc5c2b70e
|
@ -16,6 +16,7 @@ import re
|
||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
import six
|
||||||
|
|
||||||
from ec2api import exception
|
from ec2api import exception
|
||||||
from ec2api.i18n import _
|
from ec2api.i18n import _
|
||||||
|
@ -25,7 +26,7 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def validate_str(val, parameter_name, max_length=None):
|
def validate_str(val, parameter_name, max_length=None):
|
||||||
if (isinstance(val, basestring) and
|
if (isinstance(val, six.string_types) and
|
||||||
(max_length is None or max_length and len(val) <= max_length)):
|
(max_length is None or max_length and len(val) <= max_length)):
|
||||||
return True
|
return True
|
||||||
raise exception.ValidationError(
|
raise exception.ValidationError(
|
||||||
|
|
Loading…
Reference in New Issue