fix unnecessary encoding issue

This commit is contained in:
Jonathan Math 2020-06-20 01:11:59 -04:00
parent df48eb50f5
commit d8e37704c9

View file

@ -109,7 +109,7 @@ def invalidate_template_cache(fragment_name, *variables):
def generate_secret_token(phrase, size=12):
"""Generate a (SHA1) security hash from the provided info."""
info = f"{phrase} {settings.SECRET_KEY}".encode('utf-8')
return hashlib.sha256(info.encode('utf-8')).hexdigest()[:size]
return hashlib.sha256(info).hexdigest()[:size]
def extract_user_agent(request):
user_agent = request.environ.get('HTTP_USER_AGENT', '').lower()