From 9e5c9efa16e14ad260791695f1904559562ca52a Mon Sep 17 00:00:00 2001 From: Wolfgang Fehr <24782511+wfehr@users.noreply.github.com> Date: Mon, 28 Jun 2021 06:13:04 +0200 Subject: [PATCH 1/2] Fix AttributeError for django 3.1 --- aldryn_search/utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aldryn_search/utils.py b/aldryn_search/utils.py index 9380bff..b259f55 100644 --- a/aldryn_search/utils.py +++ b/aldryn_search/utils.py @@ -4,8 +4,7 @@ import importlib import re -from django.core.exceptions import ImproperlyConfigured -from django.db import models +from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured from django.utils.encoding import force_text from cms.utils.i18n import get_language_code @@ -122,7 +121,7 @@ def get_field_value(obj, name): try: obj._meta.get_field(name) - except (AttributeError, models.FieldDoesNotExist): + except (AttributeError, FieldDoesNotExist): # we catch attribute error because obj will not always be a model # specially when going through multiple relationships. value = getattr(obj, name, None) or '' From ba8a0e207954b45b0753fe327113f11275500c97 Mon Sep 17 00:00:00 2001 From: Wolfgang Fehr <24782511+wfehr@users.noreply.github.com> Date: Tue, 14 May 2024 06:27:26 +0200 Subject: [PATCH 2/2] Fix requirement for html-cleaner (requires seperate package now) --- aldryn_search/utils.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aldryn_search/utils.py b/aldryn_search/utils.py index b259f55..79b6da4 100644 --- a/aldryn_search/utils.py +++ b/aldryn_search/utils.py @@ -13,7 +13,7 @@ from haystack import DEFAULT_ALIAS from haystack.indexes import SearchIndex from lxml.etree import ParseError, ParserError -from lxml.html.clean import Cleaner as LxmlCleaner +from lxml_html_clean import Cleaner as LxmlCleaner from .conf import settings diff --git a/setup.py b/setup.py index e291d8f..82a6c91 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ REQUIREMENTS = [ - 'lxml', + 'lxml[html_clean]', 'setuptools', 'django-appconf', 'django-cms>=3.4.5',