From a7ac18f6091371c4d287f3b49b9932c63ba4267f Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Thu, 29 Sep 2022 19:43:38 +0100 Subject: [PATCH] Reword special-purpose FieldPanel deprecation message for clarity Multiple people on Slack support have asked "how do I fix this error" now, which suggests that the wording here needs improvement... * change "is obsolete" to "is no longer required", to make it sound less "your code is broken" and more "here's an improvement you can make" (but also state that it'll be removed in a future release, to make it clear that you have to do it soomer or later) * leave out the full module paths - they're probably coming across as internal tech gobbledegook rather than informative, and obscuring the word "Panel" which is the most important thing in the message * link to the release note to clear up any remaining confusion --- wagtail/admin/panels.py | 8 ++++++-- wagtail/documents/edit_handlers.py | 4 +++- wagtail/images/edit_handlers.py | 4 +++- wagtail/snippets/edit_handlers.py | 4 +++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/wagtail/admin/panels.py b/wagtail/admin/panels.py index 462809fbd4..2888071bdc 100644 --- a/wagtail/admin/panels.py +++ b/wagtail/admin/panels.py @@ -750,7 +750,9 @@ class FieldPanel(Panel): class RichTextFieldPanel(FieldPanel): def __init__(self, *args, **kwargs): warn( - "wagtail.admin.edit_handlers.RichTextFieldPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel", + "RichTextFieldPanel is no longer required for rich text fields, and should be replaced by FieldPanel. " + "RichTextFieldPanel will be removed in a future release. " + "See https://docs.wagtail.org/en/stable/releases/3.0.html#removal-of-special-purpose-field-panel-types", category=RemovedInWagtail50Warning, stacklevel=2, ) @@ -1128,7 +1130,9 @@ def reset_page_edit_handler_cache(**kwargs): class StreamFieldPanel(FieldPanel): def __init__(self, *args, **kwargs): warn( - "wagtail.admin.edit_handlers.StreamFieldPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel", + "StreamFieldPanel is no longer required when using StreamField, and should be replaced by FieldPanel. " + "StreamFieldPanel will be removed in a future release. " + "See https://docs.wagtail.org/en/stable/releases/3.0.html#removal-of-special-purpose-field-panel-types", category=RemovedInWagtail50Warning, stacklevel=2, ) diff --git a/wagtail/documents/edit_handlers.py b/wagtail/documents/edit_handlers.py index e2e8757b5e..d3f0477513 100644 --- a/wagtail/documents/edit_handlers.py +++ b/wagtail/documents/edit_handlers.py @@ -7,7 +7,9 @@ from wagtail.utils.deprecation import RemovedInWagtail50Warning class DocumentChooserPanel(FieldPanel): def __init__(self, *args, **kwargs): warn( - "wagtail.documents.edit_handlers.DocumentChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel", + "DocumentChooserPanel is no longer required for document choosers, and should be replaced by FieldPanel. " + "DocumentChooserPanel will be removed in a future release. " + "See https://docs.wagtail.org/en/stable/releases/3.0.html#removal-of-special-purpose-field-panel-types", category=RemovedInWagtail50Warning, stacklevel=2, ) diff --git a/wagtail/images/edit_handlers.py b/wagtail/images/edit_handlers.py index 2096146d4c..109d8f425f 100644 --- a/wagtail/images/edit_handlers.py +++ b/wagtail/images/edit_handlers.py @@ -10,7 +10,9 @@ from wagtail.utils.deprecation import RemovedInWagtail50Warning class ImageChooserPanel(FieldPanel): def __init__(self, *args, **kwargs): warn( - "wagtail.images.edit_handlers.ImageChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel", + "ImageChooserPanel is no longer required for image choosers, and should be replaced by FieldPanel. " + "ImageChooserPanel will be removed in a future release. " + "See https://docs.wagtail.org/en/stable/releases/3.0.html#removal-of-special-purpose-field-panel-types", category=RemovedInWagtail50Warning, stacklevel=2, ) diff --git a/wagtail/snippets/edit_handlers.py b/wagtail/snippets/edit_handlers.py index 3e6567afaf..5ce3e7f5ea 100644 --- a/wagtail/snippets/edit_handlers.py +++ b/wagtail/snippets/edit_handlers.py @@ -7,7 +7,9 @@ from wagtail.utils.deprecation import RemovedInWagtail50Warning class SnippetChooserPanel(FieldPanel): def __init__(self, *args, **kwargs): warn( - "wagtail.snippets.edit_handlers.SnippetChooserPanel is obsolete and should be replaced by wagtail.admin.panels.FieldPanel", + "SnippetChooserPanel is no longer required for snippet choosers, and should be replaced by FieldPanel. " + "SnippetChooserPanel will be removed in a future release. " + "See https://docs.wagtail.org/en/stable/releases/3.0.html#removal-of-special-purpose-field-panel-types", category=RemovedInWagtail50Warning, stacklevel=2, )