From eb2797aa19e7ad17b1815d1abae0e9292053ce44 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 12 Nov 2021 10:36:53 +0100 Subject: [PATCH] Remove force_text usage --- tests/xapian_tests/tests/test_backend.py | 3 +-- xapian_backend.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/xapian_tests/tests/test_backend.py b/tests/xapian_tests/tests/test_backend.py index 7b74a5a..c0e4c1e 100644 --- a/tests/xapian_tests/tests/test_backend.py +++ b/tests/xapian_tests/tests/test_backend.py @@ -9,7 +9,6 @@ from django.apps import apps from django.contrib.contenttypes.models import ContentType from django.test import TestCase -from django.utils.encoding import force_text from haystack import connections from haystack.backends.xapian_backend import InvalidIndexError, _term_to_xapian_value @@ -566,7 +565,7 @@ def test_term_to_xapian_value(self): self.assertEqual(_term_to_xapian_value([1, 2, 3], 'text'), '[1, 2, 3]') self.assertEqual(_term_to_xapian_value((1, 2, 3), 'text'), '(1, 2, 3)') self.assertEqual(_term_to_xapian_value({'a': 1, 'c': 3, 'b': 2}, 'text'), - force_text({'a': 1, 'c': 3, 'b': 2})) + str({'a': 1, 'c': 3, 'b': 2})) self.assertEqual(_term_to_xapian_value(datetime.datetime(2009, 5, 9, 16, 14), 'datetime'), '20090509161400') self.assertEqual(_term_to_xapian_value(datetime.datetime(2009, 5, 9, 0, 0), 'date'), diff --git a/xapian_backend.py b/xapian_backend.py index 5438e3c..b0d3d7b 100755 --- a/xapian_backend.py +++ b/xapian_backend.py @@ -7,7 +7,6 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.utils.encoding import force_text from haystack import connections from haystack.backends import BaseEngine, BaseSearchBackend, BaseSearchQuery, SearchNode, log_query @@ -1605,7 +1604,7 @@ def _to_xapian_term(term): Converts a Python type to a Xapian term that can be indexed. """ - return force_text(term).lower() + return str(term).lower() def _from_xapian_value(value, field_type):