Skip to content

Commit

Permalink
Use force_str instead of force_text.
Browse files Browse the repository at this point in the history
The latter is pending deprecation since it's an alias of the former on
Python 3.
  • Loading branch information
charettes committed Jun 5, 2020
1 parent c615d9d commit 337470f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions picklefield/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 337470f

Please sign in to comment.