# HG changeset patch # User Denis Laxalde # Date 1488808200 -3600 # Node ID 116005b5fce913686adfcd01104f8308cf6b6990 # Parent 7b975655d0ae15780d0aca7074b5ef30c061f78e [server] Make cubicweb/server/utils.py flake8-clean diff -r 7b975655d0ae -r 116005b5fce9 cubicweb/server/utils.py --- a/cubicweb/server/utils.py Mon Mar 06 14:38:52 2017 +0100 +++ b/cubicweb/server/utils.py Mon Mar 06 14:50:00 2017 +0100 @@ -26,7 +26,7 @@ from threading import Thread from getpass import getpass -from six import PY2, text_type +from six import PY2 from six.moves import input from passlib.utils import handlers as uh, to_hash_str @@ -59,10 +59,12 @@ return md5crypt(secret, self.salt.encode('ascii')).decode('utf-8') _calc_checksum = calc_checksum + _CRYPTO_CTX = CryptContext(['sha512_crypt', CustomMD5Crypt, 'des_crypt', 'ldap_salted_sha1'], deprecated=['cubicwebmd5crypt', 'des_crypt']) verify_and_update = _CRYPTO_CTX.verify_and_update + def crypt_password(passwd, salt=None): """return the encrypted password using the given salt or a generated one """ @@ -74,11 +76,12 @@ try: if _CRYPTO_CTX.verify(passwd, salt): return salt - except ValueError: # e.g. couldn't identify hash + except ValueError: # e.g. couldn't identify hash pass # wrong password return b'' + @deprecated('[3.22] no more necessary, directly get eschema.eid') def eschema_eid(cnx, eschema): """get eid of the CWEType entity for the given yams type. @@ -93,6 +96,7 @@ DEFAULT_MSG = 'we need a manager connection on the repository \ (the server doesn\'t have to run, even should better not)' + def manager_userpasswd(user=None, msg=DEFAULT_MSG, confirm=False, passwdmsg='password'): if not user: @@ -157,6 +161,8 @@ _MARKER = object() + + def func_name(func): name = getattr(func, '__name__', _MARKER) if name is _MARKER: diff -r 7b975655d0ae -r 116005b5fce9 flake8-ok-files.txt --- a/flake8-ok-files.txt Mon Mar 06 14:38:52 2017 +0100 +++ b/flake8-ok-files.txt Mon Mar 06 14:50:00 2017 +0100 @@ -37,6 +37,7 @@ cubicweb/server/schema2sql.py cubicweb/server/session.py cubicweb/server/sqlutils.py +cubicweb/server/utils.py cubicweb/server/test/datacomputed/migratedapp/schema.py cubicweb/server/test/datacomputed/schema.py cubicweb/server/test/data/entities.py