Remove force_text usage

This commit is contained in:
Claude Paroz 2021-11-12 10:36:53 +01:00
parent 32aadd8e65
commit eb2797aa19
2 changed files with 2 additions and 4 deletions

View File

@ -9,7 +9,6 @@ import os
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 @@ class BackendFeaturesTestCase(HaystackBackendTestCase, TestCase):
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'),

View File

@ -7,7 +7,6 @@ import sys
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):