# HG changeset patch # User RĂ©mi Cardona # Date 1442331067 -7200 # Node ID 77333ec71fabd8feae8c1c6b8dd393cc463cf2cf # Parent 59ec0aaae08b907123b374b085b86810ad17e72f [server/utils] convert to py3k using six diff -r 59ec0aaae08b -r 77333ec71fab server/utils.py --- a/server/utils.py Tue Sep 15 17:28:05 2015 +0200 +++ b/server/utils.py Tue Sep 15 17:31:07 2015 +0200 @@ -25,6 +25,9 @@ from threading import Timer, Thread from getpass import getpass +from six import PY2, text_type +from six.moves import input + from passlib.utils import handlers as uh, to_hash_str from passlib.context import CryptContext @@ -82,7 +85,7 @@ if eschema.eid is None: eschema.eid = cnx.execute( 'Any X WHERE X is CWEType, X name %(name)s', - {'name': unicode(eschema)})[0][0] + {'name': text_type(eschema)})[0][0] return eschema.eid @@ -95,8 +98,9 @@ if msg: print(msg) while not user: - user = raw_input('login: ') - user = unicode(user, sys.stdin.encoding) + user = input('login: ') + if PY2: + user = unicode(user, sys.stdin.encoding) passwd = getpass('%s: ' % passwdmsg) if confirm: while True: