From 4026313b0758769568bae7d8030a9db828faae64 Mon Sep 17 00:00:00 2001 From: Raffaele Salmaso Date: Sat, 24 Feb 2018 12:34:58 +0100 Subject: [PATCH] Deprecate wiki.urls.get_pattern --- docs/release_notes.rst | 1 + src/wiki/conf/settings.py | 2 +- src/wiki/urls.py | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 8493537e..da596e50 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -40,6 +40,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` django-wiki 0.3.1 diff --git a/src/wiki/conf/settings.py b/src/wiki/conf/settings.py index 095a53df..2fffec26 100644 --- a/src/wiki/conf/settings.py +++ b/src/wiki/conf/settings.py @@ -263,7 +263,7 @@ USE_BOOTSTRAP_SELECT_WIDGET = getattr( URL_CONFIG_CLASS = getattr( django_settings, 'WIKI_URL_CONFIG_CLASS', - 'wiki.urls.WikiURLPatterns') + None) #: Search view - dotted path denoting where the search view Class is located. SEARCH_VIEW = getattr( diff --git a/src/wiki/urls.py b/src/wiki/urls.py index b0ee7b9a..45bee049 100644 --- a/src/wiki/urls.py +++ b/src/wiki/urls.py @@ -253,11 +253,20 @@ def get_pattern(app_name="wiki", namespace="wiki", url_config_class=None): single Django project. https://docs.djangoproject.com/en/dev/topics/http/urls/#topics-http-reversing-url-namespaces """ + import warnings + warnings.warn( + "wiki.urls.get_pattern is deprecated and will be removed in next version, just `include('wiki.urls')` in your urlconf", + DeprecationWarning + ) if url_config_class is None: url_config_classname = getattr(settings, 'URL_CONFIG_CLASS', None) if url_config_classname is None: url_config_class = WikiURLPatterns else: + warnings.warn( + "URL_CONFIG_CLASS is deprecated and will be removed in next version, override `wiki.sites.WikiSite` instead", + DeprecationWarning + ) url_config_class = import_string(url_config_classname) urlpatterns = url_config_class().get_urls() -- 2.45.2