Replaced all DeprecationWarnngs with RemovedInWagtail06Warnings

This commit is contained in:
Karl Hobley 2014-07-23 15:16:59 +01:00
parent cba284b2c4
commit 77673d7bf8
12 changed files with 48 additions and 16 deletions

View file

@ -3,9 +3,12 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The wagtail.wagtailadmin.hooks module has been moved. "
"Use wagtail.wagtailcore.hooks instead.", DeprecationWarning)
"Use wagtail.wagtailcore.hooks instead.", RemovedInWagtail06Warning)
from wagtail.wagtailcore.hooks import register, get_hooks

View file

@ -3,16 +3,20 @@ import warnings
from django import template
from django.template.loader import render_to_string
from wagtail.utils.deprecation import RemovedInWagtail06Warning
from wagtail.wagtailcore.models import Page
register = template.Library()
@register.simple_tag(takes_context=True)
def wagtailuserbar(context, css_path=None):
if css_path is not None:
warnings.warn(
"Passing a CSS path to the wagtailuserbar tag is no longer required; use {% wagtailuserbar %} instead",
DeprecationWarning
RemovedInWagtail06Warning
)
# Find request object

View file

@ -12,6 +12,8 @@ from django.utils.translation import ugettext as _
from django.views.decorators.http import require_GET
from django.views.decorators.vary import vary_on_headers
from wagtail.utils.deprecation import RemovedInWagtail06Warning
from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList
from wagtail.wagtailadmin.forms import SearchForm
from wagtail.wagtailadmin import tasks, signals
@ -429,7 +431,7 @@ def get_preview_response(page, preview_mode):
if response:
warnings.warn(
"Defining 'show_as_mode' on a page model is deprecated. Use 'serve_preview' instead",
DeprecationWarning
RemovedInWagtail06Warning
)
return response
else:

View file

@ -25,6 +25,8 @@ from django.utils.encoding import python_2_unicode_compatible
from treebeard.mp_tree import MP_Node
from wagtail.utils.deprecation import RemovedInWagtail06Warning
from wagtail.wagtailcore.utils import camelcase_to_underscore
from wagtail.wagtailcore.query import PageQuerySet
from wagtail.wagtailcore.url_routing import RouteResult
@ -151,7 +153,7 @@ def get_leaf_page_content_type_ids():
get_leaf_page_content_type_ids is deprecated, as it treats pages without an explicit subpage_types
setting as 'leaf' pages. Code that calls get_leaf_page_content_type_ids must be rewritten to avoid
this incorrect assumption.
""", DeprecationWarning)
""", RemovedInWagtail06Warning)
return [
content_type.id
for content_type in get_page_types()
@ -163,7 +165,7 @@ def get_navigable_page_content_type_ids():
get_navigable_page_content_type_ids is deprecated, as it treats pages without an explicit subpage_types
setting as 'leaf' pages. Code that calls get_navigable_page_content_type_ids must be rewritten to avoid
this incorrect assumption.
""", DeprecationWarning)
""", RemovedInWagtail06Warning)
return [
content_type.id
for content_type in get_page_types()
@ -476,7 +478,7 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index
def get_other_siblings(self):
warnings.warn(
"The 'Page.get_other_siblings()' method has been replaced. "
"Use 'Page.get_siblings(inclusive=False)' instead.", DeprecationWarning)
"Use 'Page.get_siblings(inclusive=False)' instead.", RemovedInWagtail06Warning)
# get sibling pages excluding self
return self.get_siblings().exclude(id=self.id)
@ -728,7 +730,7 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index
modes = self.get_page_modes()
if modes is not Page.DEFAULT_PREVIEW_MODES:
# User has overriden get_page_modes instead of using preview_modes
warnings.warn("Overriding get_page_modes is deprecated. Define a preview_modes property instead", DeprecationWarning)
warnings.warn("Overriding get_page_modes is deprecated. Define a preview_modes property instead", RemovedInWagtail06Warning)
return modes

View file

@ -1,8 +1,11 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The pageurl tag library has been moved to wagtailcore_tags. "
"Use {% load wagtailcore_tags %} instead.", DeprecationWarning)
"Use {% load wagtailcore_tags %} instead.", RemovedInWagtail06Warning)
from wagtail.wagtailcore.templatetags.wagtailcore_tags import register, pageurl

View file

@ -1,8 +1,11 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The rich_text tag library has been moved to wagtailcore_tags. "
"Use {% load wagtailcore_tags %} instead.", DeprecationWarning)
"Use {% load wagtailcore_tags %} instead.", RemovedInWagtail06Warning)
from wagtail.wagtailcore.templatetags.wagtailcore_tags import register, richtext

View file

@ -3,6 +3,8 @@ import warnings
from django.test import TestCase, Client
from django.http import HttpRequest, Http404
from wagtail.utils.deprecation import RemovedInWagtail06Warning
from wagtail.wagtailcore.models import Page, Site
from wagtail.tests.models import EventPage, EventIndex, SimplePage, PageWithOldStyleRouteMethod
@ -240,9 +242,9 @@ class TestServeView(TestCase):
with warnings.catch_warnings(record=True) as w:
response = self.client.get('/old-style-route/')
# Check that a DeprecationWarning has been triggered
# Check that a RemovedInWagtail06Warning has been triggered
self.assertEqual(len(w), 1)
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
self.assertTrue(issubclass(w[-1].category, RemovedInWagtail06Warning))
self.assertTrue("Page.route should return an instance of wagtailcore.url_routing.RouteResult" in str(w[-1].message))
expected_page = PageWithOldStyleRouteMethod.objects.get(url_path='/home/old-style-route/')

View file

@ -1,7 +1,10 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The wagtail.wagtailcore.util module has been renamed. "
"Use wagtail.wagtailcore.utils instead.", DeprecationWarning)
"Use wagtail.wagtailcore.utils instead.", RemovedInWagtail06Warning)
from .utils import *

View file

@ -5,6 +5,8 @@ from django.shortcuts import get_object_or_404, redirect
from django.core.urlresolvers import reverse
from django.conf import settings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.models import Page, PageViewRestriction
from wagtail.wagtailcore.forms import PasswordPageViewRestrictionForm
@ -21,7 +23,7 @@ def serve(request, path):
if isinstance(route_result, HttpResponse):
warnings.warn(
"Page.route should return an instance of wagtailcore.url_routing.RouteResult, not an HttpResponse",
DeprecationWarning
RemovedInWagtail06Warning
)
return route_result

View file

@ -1,8 +1,11 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The embed_filters tag library has been moved to wagtailembeds_tags. "
"Use {% load wagtailembeds_tags %} instead.", DeprecationWarning)
"Use {% load wagtailembeds_tags %} instead.", RemovedInWagtail06Warning)
from wagtail.wagtailembeds.templatetags.wagtailembeds_tags import register, embed

View file

@ -1,8 +1,11 @@
import warnings
from wagtail.utils.deprecation import RemovedInWagtail06Warning
warnings.warn(
"The image_tags tag library has been moved to wagtailimages_tags. "
"Use {% load wagtailimages_tags %} instead.", DeprecationWarning)
"Use {% load wagtailimages_tags %} instead.", RemovedInWagtail06Warning)
from wagtail.wagtailimages.templatetags.wagtailimages_tags import register, image

View file

@ -4,6 +4,8 @@ from six import string_types
from django.db import models
from wagtail.utils.deprecation import RemovedInWagtail06Warning
class Indexed(object):
@classmethod
@ -77,7 +79,7 @@ class Indexed(object):
# Display deprecation warning if indexed_fields has been used
if indexed_fields:
warnings.warn("'indexed_fields' setting is now deprecated."
"Use 'search_fields' instead.", DeprecationWarning)
"Use 'search_fields' instead.", RemovedInWagtail06Warning)
# Convert them into search fields
for field_name, _config in indexed_fields.items():