Skip to content
Browse files

[py3] Pass bytes to md5 in truncate_name

  • Loading branch information...
1 parent 2d2dca2 commit 187ec5a1664377337afdc9c701307717ab80ab9e @claudep claudep committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 django/db/backends/util.py
View
3 django/db/backends/util.py
@@ -6,6 +6,7 @@
from time import time
from django.conf import settings
+from django.utils.encoding import smart_bytes
from django.utils.log import getLogger
from django.utils.timezone import utc
@@ -137,7 +138,7 @@ def truncate_name(name, length=None, hash_len=4):
if length is None or len(name) <= length:
return name
- hsh = hashlib.md5(name).hexdigest()[:hash_len]
+ hsh = hashlib.md5(smart_bytes(name)).hexdigest()[:hash_len]
return '%s%s' % (name[:length-hash_len], hsh)
def format_number(value, max_digits, decimal_places):

0 comments on commit 187ec5a

Please sign in to comment.
Something went wrong with that request. Please try again.