Removed backwards compatibility for is_abstract

pull/1901/head
Karl Hobley 2015-11-04 12:21:42 +00:00
rodzic 3bfd9fca9f
commit 66a8f65f78
2 zmienionych plików z 2 dodań i 29 usunięć

Wyświetl plik

@ -42,7 +42,7 @@ from wagtail.wagtailcore.signals import page_published, page_unpublished
from wagtail.wagtailsearch import index
from wagtail.wagtailsearch.backends import get_search_backend
from wagtail.utils.deprecation import RemovedInWagtail13Warning, RemovedInWagtail14Warning
from wagtail.utils.deprecation import RemovedInWagtail14Warning
logger = logging.getLogger('wagtail.core')
@ -204,13 +204,7 @@ class PageBase(models.base.ModelBase):
# All pages should be creatable unless explicitly set otherwise.
# This attribute is not inheritable.
if 'is_creatable' not in dct:
if 'is_abstract' in dct:
warnings.warn(
"The is_abstract flag is deprecated - use is_creatable instead.",
RemovedInWagtail13Warning)
cls.is_creatable = not dct['is_abstract']
else:
cls.is_creatable = not cls._meta.abstract
cls.is_creatable = not cls._meta.abstract
if cls.is_creatable:
# register this type in the list of page content types

Wyświetl plik

@ -1,6 +1,5 @@
import datetime
import json
import warnings
import pytz
@ -10,7 +9,6 @@ from django.http import HttpRequest, Http404
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.utils.six import text_type
from wagtail.wagtailcore.models import Page, Site, PAGE_MODEL_CLASSES
from wagtail.tests.testapp.models import (
@ -841,22 +839,3 @@ class TestIsCreatable(TestCase):
"""
self.assertFalse(AbstractPage.is_creatable)
self.assertNotIn(AbstractPage, PAGE_MODEL_CLASSES)
def test_is_abstract(self):
"""
is_abstract has been deprecated. Check that it still works, but issues
a deprecation warning
"""
with warnings.catch_warnings(record=True) as ws:
class IsAbstractPage(Page):
is_abstract = True
class Meta:
abstract = True
self.assertEqual(len(ws), 1)
warning = ws[0]
self.assertIn("is_creatable", text_type(warning.message))
self.assertFalse(AbstractPage.is_creatable)
self.assertNotIn(AbstractPage, PAGE_MODEL_CLASSES)