kopia lustrzana https://github.com/wagtail/wagtail
Bump deprecations started in 5.2 to RemovedInWagtail70Warning
These will not be removed in 6.0, to ensure that the two-release deprecation period is still in place. The removal of the legacy moderation is an exception, as this was slated for removal from 2.x, long before the deprecation warnings were put in place.pull/11157/head
rodzic
aae3ce1c84
commit
e97af885ec
|
@ -23,7 +23,7 @@ export class ExpandingFormset {
|
|||
} else if (emptyFormElement instanceof HTMLScriptElement) {
|
||||
/**
|
||||
* Support legacy `<script type="text/django-form-template">` until removed
|
||||
* @deprecated RemovedInWagtail60
|
||||
* @deprecated RemovedInWagtail70
|
||||
*/
|
||||
this.emptyFormTemplate =
|
||||
emptyFormElement.innerText || emptyFormElement.textContent;
|
||||
|
@ -44,7 +44,7 @@ export class ExpandingFormset {
|
|||
.replace(/__prefix__(.*?['"])/g, formIndex + '$1')
|
||||
/**
|
||||
* Replace inner escaped `<script>...<-/script>` tags with `<script>` tags
|
||||
* @deprecated RemovedInWagtail60
|
||||
* @deprecated RemovedInWagtail70
|
||||
*/
|
||||
.replace(/<-(-*)\/script>/g, '<$1/script>');
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail import hooks
|
|||
from wagtail.admin.ui.sidebar import LinkMenuItem as LinkMenuItemComponent
|
||||
from wagtail.admin.ui.sidebar import SubMenuItem as SubMenuItemComponent
|
||||
from wagtail.coreutils import cautious_slugify
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class MenuItem(metaclass=MediaDefiningClass):
|
||||
|
@ -26,7 +26,7 @@ class MenuItem(metaclass=MediaDefiningClass):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for MenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
self.label = label
|
||||
self.url = url
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.utils.text import slugify
|
|||
|
||||
from wagtail import hooks
|
||||
from wagtail.admin.forms.search import SearchForm
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class SearchArea(metaclass=MediaDefiningClass):
|
||||
|
@ -29,7 +29,7 @@ class SearchArea(metaclass=MediaDefiningClass):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for SearchArea is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
self.label = label
|
||||
self.url = url
|
||||
|
|
|
@ -57,7 +57,10 @@ from wagtail.models import (
|
|||
from wagtail.permission_policies.pages import PagePermissionPolicy
|
||||
from wagtail.telepath import JSContext
|
||||
from wagtail.users.utils import get_gravatar_url
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import (
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
@ -301,7 +304,7 @@ class EscapeScriptNode(template.Node):
|
|||
super().__init__()
|
||||
warn(
|
||||
"The `escapescript` template tag is deprecated - use `template` elements instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
self.nodelist = nodelist
|
||||
|
||||
|
@ -460,7 +463,7 @@ def page_listing_buttons(context, page, user):
|
|||
warn(
|
||||
"`register_page_listing_buttons` hook functions should accept a `user` argument instead of `page_perms` -"
|
||||
f" {hook.__module__}.{hook.__name__} needs to be updated",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
page_perms = page.permissions_for_user(user)
|
||||
|
@ -476,7 +479,7 @@ def page_listing_buttons(context, page, user):
|
|||
warn(
|
||||
"`construct_page_listing_buttons` hook functions should accept a `user` argument instead of `page_perms` -"
|
||||
f" {hook.__module__}.{hook.__name__} needs to be updated",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
page_perms = page.permissions_for_user(user)
|
||||
|
@ -504,7 +507,7 @@ def page_header_buttons(context, page, user, view_name):
|
|||
warn(
|
||||
"`register_page_header_buttons` hook functions should accept a `user` argument instead of `page_perms` -"
|
||||
f" {hook.__module__}.{hook.__name__} needs to be updated",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
page_perms = page.permissions_for_user(user)
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.models import GroupPagePermission, Locale, Page, Workflow
|
|||
from wagtail.test.testapp.models import SimplePage, SingleEventPage, StandardIndex
|
||||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.test.utils.timestamps import local_datetime
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class TestPageExplorer(WagtailTestUtils, TestCase):
|
||||
|
@ -195,7 +195,7 @@ class TestPageExplorer(WagtailTestUtils, TestCase):
|
|||
"construct_page_listing_buttons", add_dummy_button
|
||||
):
|
||||
with self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`construct_page_listing_buttons` hook functions should accept a `user` argument instead of `page_perms`",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.admin.widgets.button import Button
|
|||
from wagtail.models import Page
|
||||
from wagtail.test.testapp.models import SimplePage
|
||||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class TestButtonsHooks(WagtailTestUtils, TestCase):
|
||||
|
@ -38,7 +38,7 @@ class TestPageListingButtonsHooks(TestButtonsHooks):
|
|||
"register_page_listing_buttons", page_listing_buttons_old_signature
|
||||
):
|
||||
with self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`register_page_listing_buttons` hook functions should accept a `user` argument instead of `page_perms`",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
@ -90,7 +90,7 @@ class TestPageListingMoreButtonsHooks(TestButtonsHooks):
|
|||
with hooks.register_temporarily(
|
||||
"register_page_listing_more_buttons", page_listing_more_buttons
|
||||
), self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`register_page_listing_more_buttons` hook functions should accept a `user` argument instead of `page_perms`",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
@ -139,7 +139,7 @@ class TestPageListingMoreButtonsHooks(TestButtonsHooks):
|
|||
page = self.root_page
|
||||
|
||||
with self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"ButtonWithDropdownFromHook should be passed a `user` argument instead of `page_perms`",
|
||||
):
|
||||
button = wagtailadmin_widgets.ButtonWithDropdownFromHook(
|
||||
|
@ -179,7 +179,7 @@ class TestPageListingMoreButtonsHooks(TestButtonsHooks):
|
|||
"register_page_listing_one_more_more_buttons",
|
||||
page_custom_listing_more_buttons,
|
||||
), self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`register_page_listing_one_more_more_buttons` hook functions should accept a `user` argument instead of `page_perms`",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
@ -330,7 +330,7 @@ class TestPageHeaderButtonsHooks(TestButtonsHooks):
|
|||
with hooks.register_temporarily(
|
||||
"register_page_header_buttons", custom_page_header_buttons
|
||||
), self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`register_page_header_buttons` hook functions should accept a `user` argument instead of `page_perms`",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
|
|
@ -20,6 +20,7 @@ from wagtail.test.testapp.models import RestaurantTag
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.utils.deprecation import (
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
|
||||
|
@ -421,7 +422,7 @@ class TestMenuItem(WagtailTestUtils, TestCase):
|
|||
|
||||
def test_menuitem_with_deprecated_classnames(self):
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"The `classnames` kwarg for MenuItem is deprecated - use `classname` instead.",
|
||||
):
|
||||
menuitem = MenuItem(
|
||||
|
|
|
@ -14,7 +14,7 @@ from wagtail.admin.ui.sidebar import (
|
|||
)
|
||||
from wagtail.telepath import JSContext
|
||||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class TestAdaptLinkMenuItem(TestCase):
|
||||
|
@ -70,7 +70,7 @@ class TestAdaptLinkMenuItem(TestCase):
|
|||
def test_adapt_with_deprecated_classnames(self):
|
||||
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"The `classnames` kwarg for sidebar LinkMenuItem is deprecated - use `classname` instead.",
|
||||
):
|
||||
packed = JSContext().pack(
|
||||
|
|
|
@ -21,7 +21,7 @@ from wagtail.test.testapp.models import (
|
|||
)
|
||||
from wagtail.test.utils.template_tests import AdminTemplateTestUtils
|
||||
from wagtail.test.utils.wagtail_tests import WagtailTestUtils
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class TestModelViewSetGroup(WagtailTestUtils, TestCase):
|
||||
|
@ -788,7 +788,7 @@ class TestBreadcrumbs(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|||
|
||||
|
||||
class TestLegacyPatterns(WagtailTestUtils, TestCase):
|
||||
# RemovedInWagtail60Warning: legacy integer pk-based URLs will be removed
|
||||
# RemovedInWagtail70Warning: legacy integer pk-based URLs will be removed
|
||||
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
@ -803,7 +803,7 @@ class TestLegacyPatterns(WagtailTestUtils, TestCase):
|
|||
edit_url = reverse("streammodel:edit", args=(quote(self.object.pk),))
|
||||
legacy_edit_url = "/admin/streammodel/1/"
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`/<pk>/` edit view URL pattern has been deprecated in favour of /edit/<pk>/.",
|
||||
):
|
||||
response = self.client.get(legacy_edit_url)
|
||||
|
@ -814,7 +814,7 @@ class TestLegacyPatterns(WagtailTestUtils, TestCase):
|
|||
delete_url = reverse("streammodel:delete", args=(quote(self.object.pk),))
|
||||
legacy_delete_url = "/admin/streammodel/1/delete/"
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`/<pk>/delete/` delete view URL pattern has been deprecated in favour of /delete/<pk>/.",
|
||||
):
|
||||
response = self.client.get(legacy_delete_url)
|
||||
|
|
|
@ -7,7 +7,7 @@ from django.utils.functional import cached_property
|
|||
|
||||
from wagtail.admin.staticfiles import versioned_static
|
||||
from wagtail.telepath import Adapter, adapter
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class BaseSidebarAdapter(Adapter):
|
||||
|
@ -36,7 +36,7 @@ class MenuItem:
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for sidebar MenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
self.name = name
|
||||
self.label = label
|
||||
|
@ -71,7 +71,7 @@ class LinkMenuItem(MenuItem):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for sidebar LinkMenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
super().__init__(
|
||||
name,
|
||||
|
@ -115,7 +115,7 @@ class ActionMenuItem(MenuItem):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for sidebar ActionMenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
super().__init__(
|
||||
name,
|
||||
|
@ -162,7 +162,7 @@ class SubMenuItem(MenuItem):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for sidebar SubMenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
super().__init__(
|
||||
name,
|
||||
|
@ -209,7 +209,7 @@ class PageExplorerMenuItem(LinkMenuItem):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for sidebar PageExplorerMenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
super().__init__(
|
||||
name,
|
||||
|
|
|
@ -14,7 +14,7 @@ from wagtail.admin.views import generic
|
|||
from wagtail.admin.views.generic import history, usage
|
||||
from wagtail.models import ReferenceIndex
|
||||
from wagtail.permissions import ModelPermissionPolicy
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
from .base import ViewSet, ViewSetGroup
|
||||
|
||||
|
@ -227,7 +227,7 @@ class ModelViewSet(ViewSet):
|
|||
"deprecated in favour of /edit/<pk>/."
|
||||
)
|
||||
% (self.__class__.__name__),
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
return redirect(self.get_url_name("edit"), pk, permanent=True)
|
||||
|
||||
|
@ -242,7 +242,7 @@ class ModelViewSet(ViewSet):
|
|||
"deprecated in favour of /delete/<pk>/."
|
||||
)
|
||||
% (self.__class__.__name__),
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
return redirect(self.get_url_name("delete"), pk, permanent=True)
|
||||
|
||||
|
@ -569,14 +569,14 @@ class ModelViewSet(ViewSet):
|
|||
path("inspect/<str:pk>/", self.inspect_view, name="inspect")
|
||||
)
|
||||
|
||||
# RemovedInWagtail60Warning: Remove legacy URL patterns
|
||||
# RemovedInWagtail70Warning: Remove legacy URL patterns
|
||||
urlpatterns += self._legacy_urlpatterns
|
||||
|
||||
return urlpatterns
|
||||
|
||||
@cached_property
|
||||
def _legacy_urlpatterns(self):
|
||||
# RemovedInWagtail60Warning: Remove legacy URL patterns
|
||||
# RemovedInWagtail70Warning: Remove legacy URL patterns
|
||||
return [
|
||||
path("<int:pk>/", self.redirect_to_edit_view),
|
||||
path("<int:pk>/delete/", self.redirect_to_delete_view),
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.utils.http import urlencode
|
|||
from wagtail import hooks
|
||||
from wagtail.admin.ui.components import Component
|
||||
from wagtail.coreutils import accepts_kwarg
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class Button(Component):
|
||||
|
@ -187,7 +187,7 @@ class ButtonWithDropdownFromHook(BaseDropdownMenuButton):
|
|||
if page_perms is not None:
|
||||
warn(
|
||||
"ButtonWithDropdownFromHook should be passed a `user` argument instead of `page_perms`",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
self.user = page_perms.user
|
||||
|
@ -219,7 +219,7 @@ class ButtonWithDropdownFromHook(BaseDropdownMenuButton):
|
|||
warn(
|
||||
f"`{self.hook_name}` hook functions should accept a `user` argument instead of `page_perms` -"
|
||||
f" {hook.__module__}.{hook.__name__} needs to be updated",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
page_perms = self.page.permissions_for_user(self.user)
|
||||
buttons.extend(hook(self.page, page_perms, self.next_url))
|
||||
|
|
|
@ -19,7 +19,7 @@ from django.utils.text import capfirst
|
|||
from wagtail.admin.staticfiles import versioned_static
|
||||
from wagtail.coreutils import accepts_kwarg
|
||||
from wagtail.telepath import JSContext
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
__all__ = [
|
||||
"BaseBlock",
|
||||
|
@ -232,7 +232,7 @@ class Block(metaclass=BaseBlock):
|
|||
else:
|
||||
warnings.warn(
|
||||
f"{self.__class__.__name__}.get_template should accept a 'value' argument as first argument",
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
)
|
||||
|
||||
template = self.get_template(**args)
|
||||
|
|
|
@ -12,7 +12,7 @@ from wagtail.admin.admin_url_finder import (
|
|||
)
|
||||
from wagtail.admin.menu import MenuItem
|
||||
from wagtail.permission_policies import ModelPermissionPolicy
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
from .permissions import user_can_edit_setting_type
|
||||
|
||||
|
@ -22,7 +22,7 @@ class SettingMenuItem(MenuItem):
|
|||
if classnames:
|
||||
warn(
|
||||
"The `classnames` kwarg for SettingMenuItem is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
classname = classname or classnames
|
||||
# Special-case FontAwesome icons to avoid the breaking changes for those customisations.
|
||||
|
|
|
@ -25,7 +25,7 @@ from django.utils.text import capfirst, slugify
|
|||
from django.utils.translation import check_for_language, get_supported_language_variant
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from wagtail.models import Site
|
||||
|
@ -104,7 +104,7 @@ def escape_script(text):
|
|||
"""
|
||||
warn(
|
||||
"The `escape_script` hook is deprecated - use `template` elements instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
return SCRIPT_RE.sub(r"<-\1/script>", text)
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.utils.html import escape
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from wagtail.utils.apps import get_app_submodules
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
from .shortcuts import get_rendition_or_not_found
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Format:
|
|||
def classnames(self):
|
||||
warn(
|
||||
"The class property `classnames` is deprecated - use `classname` instead.",
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
return self.classname
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ from wagtail.images.utils import generate_signature, verify_signature
|
|||
from wagtail.images.views.serve import ServeView
|
||||
from wagtail.test.testapp.models import CustomImage, CustomImageFilePath
|
||||
from wagtail.test.utils import WagtailTestUtils, disconnect_signal_receiver
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
from .utils import (
|
||||
Image,
|
||||
|
@ -306,7 +306,7 @@ class TestFormat(WagtailTestUtils, TestCase):
|
|||
self.assertEqual(result, self.format)
|
||||
|
||||
def test_deprecated_classnames_property_access(self):
|
||||
with self.assertWarns(RemovedInWagtail60Warning):
|
||||
with self.assertWarns(RemovedInWagtail70Warning):
|
||||
classname = self.format.classnames
|
||||
self.assertEqual(classname, "test is-primary")
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.test.utils.template_tests import AdminTemplateTestUtils
|
||||
from wagtail.test.utils.timestamps import submittable_timestamp
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
from wagtail.utils.timestamps import render_timestamp
|
||||
|
||||
|
||||
|
@ -286,7 +286,7 @@ class TestSnippetListView(WagtailTestUtils, TestCase):
|
|||
"construct_snippet_listing_buttons",
|
||||
register_snippet_listing_button_item,
|
||||
), self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"construct_snippet_listing_buttons hook no longer accepts a context argument",
|
||||
):
|
||||
response = self.get()
|
||||
|
@ -5374,7 +5374,7 @@ class TestSnippetViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
|||
|
||||
def test_redirect_to_edit(self):
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`/<pk>/` edit view URL pattern has been deprecated in favour of /edit/<pk>/.",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
@ -5388,7 +5388,7 @@ class TestSnippetViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
|||
|
||||
def test_redirect_to_delete(self):
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`/<pk>/delete/` delete view URL pattern has been deprecated in favour of /delete/<pk>/.",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
@ -5402,7 +5402,7 @@ class TestSnippetViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
|||
|
||||
def test_redirect_to_usage(self):
|
||||
with self.assertWarnsRegex(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"`/<pk>/usage/` usage view URL pattern has been deprecated in favour of /usage/<pk>/.",
|
||||
):
|
||||
response = self.client.get(
|
||||
|
|
|
@ -51,7 +51,7 @@ from wagtail.snippets.models import SnippetAdminURLFinder, get_snippet_models
|
|||
from wagtail.snippets.permissions import user_can_edit_snippet_type
|
||||
from wagtail.snippets.side_panels import SnippetStatusSidePanel
|
||||
from wagtail.snippets.views.chooser import SnippetChooserViewSet
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
# == Helper functions ==
|
||||
|
@ -199,7 +199,7 @@ class IndexView(generic.IndexViewOptionalFeaturesMixin, generic.IndexView):
|
|||
except TypeError:
|
||||
warn(
|
||||
"construct_snippet_listing_buttons hook no longer accepts a context argument",
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
hook(more_buttons, instance, self.request.user, {})
|
||||
|
@ -894,7 +894,7 @@ class SnippetViewSet(ModelViewSet):
|
|||
"deprecated in favour of /usage/<pk>/."
|
||||
)
|
||||
% (self.__class__.__name__),
|
||||
category=RemovedInWagtail60Warning,
|
||||
category=RemovedInWagtail70Warning,
|
||||
)
|
||||
return redirect(self.get_url_name("usage"), pk, permanent=True)
|
||||
|
||||
|
@ -1259,13 +1259,13 @@ class SnippetViewSet(ModelViewSet):
|
|||
),
|
||||
]
|
||||
|
||||
# RemovedInWagtail60Warning: Remove legacy URL patterns
|
||||
# RemovedInWagtail70Warning: Remove legacy URL patterns
|
||||
return urlpatterns + self._legacy_urlpatterns
|
||||
|
||||
@cached_property
|
||||
def _legacy_urlpatterns(self):
|
||||
return [
|
||||
# RemovedInWagtail60Warning: Remove legacy URL patterns
|
||||
# RemovedInWagtail70Warning: Remove legacy URL patterns
|
||||
# legacy URLs that could potentially collide if the pk matches one of the reserved names above
|
||||
# ('add', 'edit' etc) - redirect to the unambiguous version
|
||||
path("<str:pk>/", self.redirect_to_edit_view),
|
||||
|
|
|
@ -28,7 +28,7 @@ from wagtail.test.testapp.blocks import LinkBlock as CustomLinkBlock
|
|||
from wagtail.test.testapp.blocks import SectionBlock
|
||||
from wagtail.test.testapp.models import EventPage, SimplePage
|
||||
from wagtail.test.utils import WagtailTestUtils
|
||||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
||||
|
||||
|
||||
class FooStreamBlock(blocks.StreamBlock):
|
||||
|
@ -5235,7 +5235,7 @@ class TestOverriddenGetTemplateBlockTag(TestCase):
|
|||
template="tests/blocks/this_shouldnt_be_used.html"
|
||||
)
|
||||
with self.assertWarnsMessage(
|
||||
RemovedInWagtail60Warning,
|
||||
RemovedInWagtail70Warning,
|
||||
"BlockUsingGetTemplateMethod.get_template should accept a 'value' argument as first argument",
|
||||
):
|
||||
html = block.render("Hello World")
|
||||
|
|
Ładowanie…
Reference in New Issue