mirror of
https://github.com/django/django.git
synced 2025-09-19 10:32:49 +03:00
Refs #27795 -- Removed force_bytes() usage in db/backends/utils.py.
This commit is contained in:
parent
ad9a28ee38
commit
1d65ddd9c3
|
@ -7,7 +7,6 @@ from time import time
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.utils import NotSupportedError
|
from django.db.utils import NotSupportedError
|
||||||
from django.utils.encoding import force_bytes
|
|
||||||
from django.utils.timezone import utc
|
from django.utils.timezone import utc
|
||||||
|
|
||||||
logger = logging.getLogger('django.db.backends')
|
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:
|
if length is None or len(name) <= length:
|
||||||
return identifier
|
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)
|
return '%s%s%s' % ('%s"."' % namespace if namespace else '', name[:length - hash_len], digest)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user