From 51ea493a261b5fe770a5c1a686c4c13269564c6d Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 4 Apr 2019 22:03:19 -0400 Subject: [PATCH] Use bytes for hash and return the unicode Signed-off-by: Roberto Rosario --- mayan/apps/common/classes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mayan/apps/common/classes.py b/mayan/apps/common/classes.py index d6ccd3263e..9cec91e637 100644 --- a/mayan/apps/common/classes.py +++ b/mayan/apps/common/classes.py @@ -405,10 +405,10 @@ class Template(object): context=context, ).render() - content = result.content.replace('\n', '') - - self.html = content - self.hex_hash = hashlib.sha256(content).hexdigest() + # Calculate the hash of the bytes version but return the unicode + # version + self.html = result.rendered_content.replace('\n', '') + self.hex_hash = hashlib.sha256(result.content).hexdigest() return self