From 337470f9f04d7b7373ac0895fa6c081fa7fa9a96 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Fri, 5 Jun 2020 09:55:58 -0400 Subject: [PATCH] Use force_str instead of force_text. The latter is pending deprecation since it's an alias of the former on Python 3. --- picklefield/fields.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/picklefield/fields.py b/picklefield/fields.py index 1e87690..2adb043 100644 --- a/picklefield/fields.py +++ b/picklefield/fields.py @@ -7,7 +7,7 @@ from django import VERSION as DJANGO_VERSION from django.core import checks from django.db import models -from django.utils.encoding import force_text +from django.utils.encoding import force_str from .constants import DEFAULT_PROTOCOL @@ -189,13 +189,13 @@ def get_db_prep_value(self, value, connection=None, prepared=False): """ if value is not None and not isinstance(value, PickledObject): - # We call force_text here explicitly, so that the encoded string + # We call force_str here explicitly, so that the encoded string # isn't rejected by the postgresql_psycopg2 backend. Alternatively, # we could have just registered PickledObject with the psycopg # marshaller (telling it to store it like it would a string), but # since both of these methods result in the same value being stored, # doing things this way is much easier. - value = force_text(dbsafe_encode(value, self.compress, self.protocol, self.copy)) + value = force_str(dbsafe_encode(value, self.compress, self.protocol, self.copy)) return value def value_to_string(self, obj):