--- 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:
--- 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