From 0d489543b833ac688cc7713722de920745c03ee7 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 21 Apr 2022 11:50:44 +0100 Subject: [PATCH] Reinstate get_snippet_edit_handler with a deprecation warning (#8407) --- wagtail/snippets/views/snippets.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wagtail/snippets/views/snippets.py b/wagtail/snippets/views/snippets.py index 04b9cb90f4..c12e4a1448 100644 --- a/wagtail/snippets/views/snippets.py +++ b/wagtail/snippets/views/snippets.py @@ -1,3 +1,4 @@ +import warnings from functools import lru_cache from urllib.parse import urlencode @@ -24,6 +25,7 @@ from wagtail.search.backends import get_search_backend from wagtail.snippets.action_menu import SnippetActionMenu from wagtail.snippets.models import get_snippet_models from wagtail.snippets.permissions import get_permission_name, user_can_edit_snippet_type +from wagtail.utils.deprecation import RemovedInWagtail50Warning # == Helper functions == @@ -55,6 +57,16 @@ def get_snippet_panel(model): return panel.bind_to_model(model) +def get_snippet_edit_handler(model): + get_snippet_panel(model) + + warnings.warn( + "The get_snippet_edit_handler function has been renamed to get_snippet_panel", + category=RemovedInWagtail50Warning, + stacklevel=2, + ) + + # == Views ==