mirror of https://gitlab.com/ita1024/waf.git
Undefined name 'unicode' in the new json methods
This commit is contained in:
parent
0e03aec82d
commit
8113778aab
|
@ -167,12 +167,16 @@ class Node(object):
|
||||||
"""
|
"""
|
||||||
import json # Python 2.6 and up
|
import json # Python 2.6 and up
|
||||||
object_pairs_hook = None
|
object_pairs_hook = None
|
||||||
|
|
||||||
if convert and sys.hexversion < 0x3000000:
|
if convert and sys.hexversion < 0x3000000:
|
||||||
|
try:
|
||||||
|
_type = unicode
|
||||||
|
except NameError:
|
||||||
|
_type = str
|
||||||
|
|
||||||
def convert(value):
|
def convert(value):
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
return [convert(element) for element in value]
|
return [convert(element) for element in value]
|
||||||
elif isinstance(value, unicode):
|
elif isinstance(value, _type):
|
||||||
return str(value)
|
return str(value)
|
||||||
else:
|
else:
|
||||||
return value
|
return value
|
||||||
|
|
Loading…
Reference in New Issue