Mercurial > kallithea
changeset 8630:11ab74b7701b
pytest: use hmac.new instead of hmac.HMAC
According to documentation, hmac.new is the way to create a HMAC object ... and
the first argument is mandaatory and we don't want to name it.
This has no functional change but will address a pytype warning:
File "kallithea/model/user.py", line 304, in get_reset_password_token: Invalid keyword arguments (digestmod, key, msg) to function HMAC.__init__ [wrong-keyword-args]
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Tue, 18 Aug 2020 22:36:45 +0200 |
parents | 9c408c0f1c9b |
children | e85f5bf7ad74 |
files | kallithea/model/user.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/model/user.py Tue Aug 18 21:36:26 2020 +0200 +++ b/kallithea/model/user.py Tue Aug 18 22:36:45 2020 +0200 @@ -301,8 +301,8 @@ guaranteed not to occur in any of the values. """ app_secret = config.get('app_instance_uuid') - return hmac.HMAC( - key='\0'.join([app_secret, user.password]).encode('utf-8'), + return hmac.new( + '\0'.join([app_secret, user.password]).encode('utf-8'), msg='\0'.join([session_id, str(user.user_id), user.email, str(timestamp)]).encode('utf-8'), digestmod=hashlib.sha1, ).hexdigest()