Skip to content

Commit

Permalink
Remove force_text usage
Browse files Browse the repository at this point in the history
  • Loading branch information
claudep committed Nov 12, 2021
1 parent 32aadd8 commit eb2797a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions tests/xapian_tests/tests/test_backend.py
Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down
3 changes: 1 addition & 2 deletions xapian_backend.py
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit eb2797a

Please sign in to comment.