From 8938e024ea8660034a7815015d124ab6970251ca Mon Sep 17 00:00:00 2001 From: Raffaele Salmaso Date: Sun, 25 Feb 2018 00:37:22 +0100 Subject: [PATCH] Removed SEARCH_VIEW setting --- docs/release_notes.rst | 1 + src/wiki/conf/settings.py | 10 ---------- src/wiki/sites.py | 5 ++--- src/wiki/urls.py | 6 +++--- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 3c20c340..808b5671 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -41,6 +41,7 @@ Deprecated/Removed * Django < 1.11 support is dropped :url-issue:`779` * Python < 3.3 support is dropped :url-issue:`779` and :url-issue:`792` * Deprecate ``wiki.urls.get_pattern`` :url-issue:`799` + * Removed ``SEARCH_VIEW`` setting, replaced by ``WikiSite`` override :url-issue:`837` django-wiki 0.3.1 diff --git a/src/wiki/conf/settings.py b/src/wiki/conf/settings.py index 2fffec26..69c6a97a 100644 --- a/src/wiki/conf/settings.py +++ b/src/wiki/conf/settings.py @@ -265,16 +265,6 @@ URL_CONFIG_CLASS = getattr( 'WIKI_URL_CONFIG_CLASS', None) -#: Search view - dotted path denoting where the search view Class is located. -SEARCH_VIEW = getattr( - django_settings, - 'WIKI_SEARCH_VIEW', - 'wiki.views.article.SearchView' - if not apps.is_installed('wiki.plugins.haystack') - else - 'wiki.plugins.haystack.views.HaystackSearchView' -) - #: Seconds of timeout before renewing the article cache. Articles are automatically #: renewed whenever an edit occurs but article content may be generated from #: other objects that are changed. diff --git a/src/wiki/sites.py b/src/wiki/sites.py index 76a005a3..bbbcb715 100644 --- a/src/wiki/sites.py +++ b/src/wiki/sites.py @@ -1,6 +1,7 @@ from django.apps import apps from django.utils.functional import LazyObject from django.utils.module_loading import import_string +from wiki.conf import settings from wiki.compat import include, url from wiki.core.plugins import registry @@ -17,7 +18,6 @@ class WikiSite: """ def __init__(self, name='wiki'): - from wiki.conf import settings from wiki.views import accounts, article, deleted_list self.name = name @@ -43,7 +43,7 @@ class WikiSite: self.revision_merge_view = getattr(self, "revision_merge_view", article.MergeView.as_view()) self.revision_preview_merge_view = getattr(self, "revision_preview_merge_view", article.MergeView.as_view(preview=True)) - self.search_view = import_string(getattr(self, "search_view", settings.SEARCH_VIEW)).as_view() + self.search_view = getattr(self, "search_view", article.SearchView.as_view()) self.article_diff_view = getattr(self, "article_diff_view", article.DiffView.as_view()) # account views @@ -89,7 +89,6 @@ class WikiSite: return urlpatterns def get_accounts_urls(self): - from wiki.conf import settings if settings.ACCOUNT_HANDLING: urlpatterns = [ url(r'^_accounts/sign-up/$', self.signup_view, name='signup'), diff --git a/src/wiki/urls.py b/src/wiki/urls.py index 45bee049..966f5941 100644 --- a/src/wiki/urls.py +++ b/src/wiki/urls.py @@ -37,7 +37,7 @@ class WikiURLPatterns: revision_change_view_class = article.ChangeRevisionView revision_merge_view_class = article.MergeView - search_view_class = settings.SEARCH_VIEW + search_view_class = article.SearchView article_diff_view_class = article.DiffView # account views @@ -75,7 +75,7 @@ class WikiURLPatterns: article.MissingRootView.as_view(), name='root_missing'), url(r'^_search/$', - import_string(self.search_view_class).as_view(), + self.search_view_class.as_view(), name='search'), url(r'^_revision/diff/(?P[0-9]+)/$', self.article_diff_view_class.as_view(), @@ -201,7 +201,7 @@ class WikiURLPatterns: self.article_dir_view_class.as_view(), name='dir'), url(r'^(?P.+/|)_search/$', - import_string(self.search_view_class).as_view(), + self.search_view_class.as_view(), name='search'), url(r'^(?P.+/|)_settings/$', self.article_settings_view_class.as_view(), -- 2.45.2