Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[py3] Pass bytes to md5 in truncate_name

  • Loading branch information...
commit 187ec5a1664377337afdc9c701307717ab80ab9e 1 parent 2d2dca2
@claudep claudep authored
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):
Please sign in to comment.
Something went wrong with that request. Please try again.