Change all unicode() calls with six.text_type().

Fixes #5329.
This commit is contained in:
Berker Peksag
2015-06-25 22:24:03 +03:00
parent a17845d42e
commit 896d00fbf2
6 changed files with 18 additions and 10 deletions

View File

@@ -178,11 +178,12 @@ u"FAIL: This file is larger than the upload limits for this site."))
def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):
# csv.py doesn't do Unicode; encode temporarily as UTF-8:
# TODO: this probably won't be necessary in Python 3
csv_reader = csv.reader(utf_8_encoder(unicode_csv_data),
dialect=dialect, **kwargs)
for row in csv_reader:
# decode UTF-8 back to Unicode, cell by cell:
yield [unicode(cell, 'utf-8') for cell in row]
yield [six.text_type(cell, 'utf-8') for cell in row]
def utf_8_encoder(unicode_csv_data):
for line in unicode_csv_data:

View File

@@ -38,7 +38,7 @@ def adduser(args):
#TODO: Lets trust admins this do not validate Emails :)
commands_util.setup_app(args)
args.username = unicode(commands_util.prompt_if_not_set(args.username, "Username:"))
args.username = six.text_type(commands_util.prompt_if_not_set(args.username, "Username:"))
args.password = commands_util.prompt_if_not_set(args.password, "Password:",True)
args.email = commands_util.prompt_if_not_set(args.email, "Email:")