0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Refs #27795 -- Removed force_bytes() usage in db/backends/utils.py.

This commit is contained in:
Jon Dufresne 2018-09-25 06:53:13 -07:00 committed by Tim Graham
parent ad9a28ee38
commit 1d65ddd9c3

View File

@ -7,7 +7,6 @@ from time import time
from django.conf import settings
from django.db.utils import NotSupportedError
from django.utils.encoding import force_bytes
from django.utils.timezone import utc
logger = logging.getLogger('django.db.backends')
@ -214,7 +213,7 @@ def truncate_name(identifier, length=None, hash_len=4):
if length is None or len(name) <= length:
return identifier
digest = hashlib.md5(force_bytes(name)).hexdigest()[:hash_len]
digest = hashlib.md5(name.encode()).hexdigest()[:hash_len]
return '%s%s%s' % ('%s"."' % namespace if namespace else '', name[:length - hash_len], digest)