From e44233ef2405b625bdae31743dd016c603f9a0fc Mon Sep 17 00:00:00 2001 From: trhr Date: Sun, 9 Feb 2020 19:54:20 -0600 Subject: [PATCH] The smart_text() and force_text() aliases (since Django 2.0) of smart_str() and force_str() are deprecated --- evennia/utils/picklefield.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/evennia/utils/picklefield.py b/evennia/utils/picklefield.py index c2b5abb98a..50408c5949 100644 --- a/evennia/utils/picklefield.py +++ b/evennia/utils/picklefield.py @@ -43,7 +43,7 @@ from django.forms.fields import CharField from django.forms.widgets import Textarea from pickle import loads, dumps -from django.utils.encoding import force_text +from django.utils.encoding import force_str DEFAULT_PROTOCOL = 4 @@ -210,10 +210,10 @@ class PickledObjectField(models.Field): """ Returns the default value for this field. - The default implementation on models.Field calls force_text + The default implementation on models.Field calls force_str on the default, which means you can't set arbitrary Python objects as the default. To fix this, we just return the value - without calling force_text on it. Note that if you set a + without calling force_str on it. Note that if you set a callable as a default, the field will still call it. It will *not* try to pickle and encode it. @@ -267,13 +267,13 @@ class PickledObjectField(models.Field): """ 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)) + value = force_str(dbsafe_encode(value, self.compress, self.protocol)) return value def value_to_string(self, obj):