From 1384129d8973fd21a463368571ce0fe7b47c7e8a Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Fri, 24 Apr 2015 09:40:21 +0100 Subject: [PATCH] Added deprecation warning for old style --- wagtail/contrib/wagtailroutablepage/models.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wagtail/contrib/wagtailroutablepage/models.py b/wagtail/contrib/wagtailroutablepage/models.py index 5628ffebaa..cd98191a5a 100644 --- a/wagtail/contrib/wagtailroutablepage/models.py +++ b/wagtail/contrib/wagtailroutablepage/models.py @@ -1,6 +1,7 @@ from __future__ import unicode_literals from six import string_types +import warnings from django.http import Http404 from django.core.urlresolvers import RegexURLResolver @@ -8,6 +9,7 @@ from django.conf.urls import url from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.url_routing import RouteResult +from wagtail.utils.deprecation import RemovedInWagtail12Warning _creation_counter = 0 @@ -41,6 +43,18 @@ class RoutablePageMixin(object): #: Set this to a tuple of ``django.conf.urls.url`` objects. subpage_urls = None + @classmethod + def check(cls, **kwargs): + if cls.subpage_urls: + warnings.warn( + "{app_label}.{classname}: subpage_urls is deprecated. Use the " + "@route decorator to define page routes instead.".format( + app_label=cls._meta.app_label, + classname=cls.__name__, + ), RemovedInWagtail12Warning) + + return super(RoutablePageMixin, cls).check(**kwargs) + @classmethod def get_subpage_urls(cls): # Old style