validators: use basestring

This commit is contained in:
Denis Jacquerye 2015-10-30 13:18:20 +00:00
parent f9ff5e5cfe
commit 41cb5a8d4c

View File

@ -3,6 +3,14 @@
import os
import calendar
# -------
# Python 2 or 3
# -------
try:
basestring
except NameError:
basestring = str
# -------
# Generic
# -------
@ -583,7 +591,8 @@ def anchorValidator(value):
"""
dictPrototype = dict(
x=((int, float), False), y=((int, float), False),
name=(str, False), color=(str, False), identifier=(str, False)
name=(basestring, False), color=(basestring, False),
identifier=(basestring, False)
)
if not genericDictValidator(value, dictPrototype):
return False
@ -848,7 +857,7 @@ def groupsValidator(value):
firstSideMapping = {}
secondSideMapping = {}
for groupName, glyphList in list(value.items()):
if not isinstance(groupName, str):
if not isinstance(groupName, (basestring)):
return False, bogusFormatMessage
if not isinstance(glyphList, (list, tuple)):
return False, bogusFormatMessage