kopia lustrzana https://github.com/wagtail/wagtail
Don't inherit from object
rodzic
f0eef2fc88
commit
ffd93a0d28
|
@ -171,7 +171,7 @@ Copy this into your project and make sure it's imported in any ``models.py`` fil
|
|||
|
||||
from django.utils import translation
|
||||
|
||||
class TranslatedField(object):
|
||||
class TranslatedField:
|
||||
def __init__(self, en_field, fr_field):
|
||||
self.en_field = en_field
|
||||
self.fr_field = fr_field
|
||||
|
|
|
@ -64,7 +64,7 @@ Hooks for building new areas of the admin interface (alongside pages, images, do
|
|||
|
||||
from wagtail.core import hooks
|
||||
|
||||
class WelcomePanel(object):
|
||||
class WelcomePanel:
|
||||
order = 50
|
||||
|
||||
def render(self):
|
||||
|
@ -503,7 +503,7 @@ Hooks for customising the way users are directed through the process of creating
|
|||
|
||||
from wagtail.core import hooks
|
||||
|
||||
class UserbarPuppyLinkItem(object):
|
||||
class UserbarPuppyLinkItem:
|
||||
def render(self, request):
|
||||
return '<li><a href="http://cuteoverload.com/tag/puppehs/" ' \
|
||||
+ 'target="_parent" class="action icon icon-wagtail">Puppies!</a></li>'
|
||||
|
|
|
@ -85,7 +85,7 @@ def extract_panel_definitions_from_model_class(model, exclude=None):
|
|||
return panels
|
||||
|
||||
|
||||
class EditHandler(object):
|
||||
class EditHandler:
|
||||
"""
|
||||
Abstract class providing sensible default behaviours for objects implementing
|
||||
the EditHandler API
|
||||
|
@ -319,7 +319,7 @@ class BaseTabbedInterface(BaseFormEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/tabbed_interface.html"
|
||||
|
||||
|
||||
class TabbedInterface(object):
|
||||
class TabbedInterface:
|
||||
def __init__(self, children, base_form_class=None):
|
||||
self.children = children
|
||||
self.base_form_class = base_form_class
|
||||
|
@ -336,7 +336,7 @@ class BaseObjectList(BaseFormEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/object_list.html"
|
||||
|
||||
|
||||
class ObjectList(object):
|
||||
class ObjectList:
|
||||
def __init__(self, children, heading="", classname="",
|
||||
base_form_class=None):
|
||||
self.children = children
|
||||
|
@ -358,7 +358,7 @@ class BaseFieldRowPanel(BaseCompositeEditHandler):
|
|||
template = "wagtailadmin/edit_handlers/field_row_panel.html"
|
||||
|
||||
|
||||
class FieldRowPanel(object):
|
||||
class FieldRowPanel:
|
||||
def __init__(self, children, classname=""):
|
||||
self.children = children
|
||||
self.classname = classname
|
||||
|
@ -389,7 +389,7 @@ class BaseMultiFieldPanel(BaseCompositeEditHandler):
|
|||
return classes
|
||||
|
||||
|
||||
class MultiFieldPanel(object):
|
||||
class MultiFieldPanel:
|
||||
def __init__(self, children, heading="", classname=""):
|
||||
self.children = children
|
||||
self.heading = heading
|
||||
|
@ -502,7 +502,7 @@ class BaseFieldPanel(EditHandler):
|
|||
return []
|
||||
|
||||
|
||||
class FieldPanel(object):
|
||||
class FieldPanel:
|
||||
def __init__(self, field_name, classname="", widget=None):
|
||||
self.field_name = field_name
|
||||
self.classname = classname
|
||||
|
@ -527,7 +527,7 @@ class BaseRichTextFieldPanel(BaseFieldPanel):
|
|||
return compare.RichTextFieldComparison
|
||||
|
||||
|
||||
class RichTextFieldPanel(object):
|
||||
class RichTextFieldPanel:
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
|
||||
|
@ -606,7 +606,7 @@ class BasePageChooserPanel(BaseChooserPanel):
|
|||
return [cls.model._meta.get_field(cls.field_name).remote_field.model]
|
||||
|
||||
|
||||
class PageChooserPanel(object):
|
||||
class PageChooserPanel:
|
||||
def __init__(self, field_name, page_type=None, can_choose_root=False):
|
||||
self.field_name = field_name
|
||||
|
||||
|
@ -733,7 +733,7 @@ class BaseInlinePanel(EditHandler):
|
|||
}))
|
||||
|
||||
|
||||
class InlinePanel(object):
|
||||
class InlinePanel:
|
||||
def __init__(self, relation_name, panels=None, classname='', label='', help_text='', min_num=None, max_num=None):
|
||||
self.relation_name = relation_name
|
||||
self.panels = panels
|
||||
|
@ -846,7 +846,7 @@ class BaseStreamFieldPanel(BaseFieldPanel):
|
|||
return ""
|
||||
|
||||
|
||||
class StreamFieldPanel(object):
|
||||
class StreamFieldPanel:
|
||||
def __init__(self, field_name, classname=''):
|
||||
self.field_name = field_name
|
||||
self.classname = classname
|
||||
|
|
|
@ -49,7 +49,7 @@ class MenuItem(metaclass=MediaDefiningClass):
|
|||
return render_to_string(self.template, context, request=request)
|
||||
|
||||
|
||||
class Menu(object):
|
||||
class Menu:
|
||||
def __init__(self, register_hook_name, construct_hook_name=None):
|
||||
self.register_hook_name = register_hook_name
|
||||
self.construct_hook_name = construct_hook_name
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.admin.edit_handlers import RichTextFieldPanel
|
|||
from wagtail.core.rich_text import DbWhitelister, expand_db_html, features
|
||||
|
||||
|
||||
class HalloPlugin(object):
|
||||
class HalloPlugin:
|
||||
def __init__(self, **kwargs):
|
||||
self.name = kwargs.get('name', None)
|
||||
self.options = kwargs.get('options', {})
|
||||
|
|
|
@ -56,7 +56,7 @@ class SearchArea(metaclass=MediaDefiningClass):
|
|||
}, request=request)
|
||||
|
||||
|
||||
class Search(object):
|
||||
class Search:
|
||||
def __init__(self, register_hook_name, construct_hook_name=None):
|
||||
self.register_hook_name = register_hook_name
|
||||
self.construct_hook_name = construct_hook_name
|
||||
|
|
|
@ -5,7 +5,7 @@ from wagtail.core import hooks
|
|||
from wagtail.core.models import Page, Site
|
||||
|
||||
|
||||
class SummaryItem(object):
|
||||
class SummaryItem:
|
||||
order = 100
|
||||
|
||||
def __init__(self, request):
|
||||
|
@ -51,7 +51,7 @@ def add_pages_summary_item(request, items):
|
|||
items.append(PagesSummaryItem(request))
|
||||
|
||||
|
||||
class SiteSummaryPanel(object):
|
||||
class SiteSummaryPanel:
|
||||
name = 'site_summary'
|
||||
order = 100
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class TestPageEditHandlers(TestCase):
|
|||
|
||||
@clear_edit_handler(ValidatedPage)
|
||||
def test_check_invalid_base_form_class(self):
|
||||
class BadFormClass(object):
|
||||
class BadFormClass:
|
||||
pass
|
||||
|
||||
invalid_base_form = checks.Error(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.template.loader import render_to_string
|
||||
|
||||
|
||||
class BaseItem(object):
|
||||
class BaseItem:
|
||||
template = 'wagtailadmin/userbar/item_base.html'
|
||||
|
||||
def render(self, request):
|
||||
|
|
|
@ -173,7 +173,7 @@ def any_permission_required(*perms):
|
|||
return user_passes_test(test)
|
||||
|
||||
|
||||
class PermissionPolicyChecker(object):
|
||||
class PermissionPolicyChecker:
|
||||
"""
|
||||
Provides a view decorator that enforces the given permission policy,
|
||||
returning the wagtailadmin 'permission denied' response if permission not granted
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.admin import messages
|
|||
from wagtail.admin.utils import permission_denied
|
||||
|
||||
|
||||
class PermissionCheckedMixin(object):
|
||||
class PermissionCheckedMixin:
|
||||
"""
|
||||
Mixin for class-based views to enforce permission checks according to
|
||||
a permission policy (see wagtail.core.permission_policies).
|
||||
|
|
|
@ -17,7 +17,7 @@ User = get_user_model()
|
|||
|
||||
# Panels for the homepage
|
||||
|
||||
class UpgradeNotificationPanel(object):
|
||||
class UpgradeNotificationPanel:
|
||||
name = 'upgrade_notification'
|
||||
order = 100
|
||||
|
||||
|
@ -31,7 +31,7 @@ class UpgradeNotificationPanel(object):
|
|||
return ""
|
||||
|
||||
|
||||
class PagesForModerationPanel(object):
|
||||
class PagesForModerationPanel:
|
||||
name = 'pages_for_moderation'
|
||||
order = 200
|
||||
|
||||
|
@ -47,7 +47,7 @@ class PagesForModerationPanel(object):
|
|||
}, request=self.request)
|
||||
|
||||
|
||||
class RecentEditsPanel(object):
|
||||
class RecentEditsPanel:
|
||||
name = 'recent_edits'
|
||||
order = 300
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from wagtail.search.backends import get_search_backend
|
|||
from wagtail.search.index import class_is_indexed
|
||||
|
||||
|
||||
class SearchableListMixin(object):
|
||||
class SearchableListMixin:
|
||||
search_box_placeholder = _("Search")
|
||||
search_fields = None
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.conf.urls import url, include
|
|||
from wagtail.core import hooks
|
||||
|
||||
|
||||
class ViewSetRegistry(object):
|
||||
class ViewSetRegistry:
|
||||
def __init__(self):
|
||||
self.viewsets = []
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
class ViewSet(object):
|
||||
class ViewSet:
|
||||
def __init__(self, name, **kwargs):
|
||||
self.name = name
|
||||
self.url_prefix = kwargs.pop('url_prefix', self.name)
|
||||
|
|
|
@ -214,7 +214,7 @@ class AdminPageChooser(AdminChooser):
|
|||
|
||||
|
||||
@total_ordering
|
||||
class Button(object):
|
||||
class Button:
|
||||
show = True
|
||||
|
||||
def __init__(self, label, url, classes=set(), attrs={}, priority=1000):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
class APIField(object):
|
||||
class APIField:
|
||||
def __init__(self, name, serializer=None):
|
||||
self.name = name
|
||||
self.serializer = serializer
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.conf.urls import include, url
|
|||
from wagtail.utils.urlpatterns import decorate_urlpatterns
|
||||
|
||||
|
||||
class WagtailAPIRouter(object):
|
||||
class WagtailAPIRouter:
|
||||
"""
|
||||
A class that provides routing and cross-linking for a collection
|
||||
of API endpoints
|
||||
|
|
|
@ -23,7 +23,7 @@ class BaseFormSubmissionsPanel(EditHandler):
|
|||
}))
|
||||
|
||||
|
||||
class FormSubmissionsPanel(object):
|
||||
class FormSubmissionsPanel:
|
||||
def __init__(self, heading=None):
|
||||
self.heading = heading
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class BaseForm(django.forms.Form):
|
|||
super(BaseForm, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class FormBuilder(object):
|
||||
class FormBuilder:
|
||||
def __init__(self, fields):
|
||||
self.fields = fields
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class PurgeRequest(Request):
|
|||
return 'PURGE'
|
||||
|
||||
|
||||
class BaseBackend(object):
|
||||
class BaseBackend:
|
||||
def purge(self, url):
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ def purge_pages_from_cache(pages, backend_settings=None, backends=None):
|
|||
purge_urls_from_cache(urls, backend_settings, backends)
|
||||
|
||||
|
||||
class PurgeBatch(object):
|
||||
class PurgeBatch:
|
||||
"""Represents a list of URLs to be purged in a single request"""
|
||||
def __init__(self, urls=None):
|
||||
self.urls = []
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.utils.encoding import force_text
|
|||
from django.utils.translation import ugettext as _
|
||||
|
||||
|
||||
class ButtonHelper(object):
|
||||
class ButtonHelper:
|
||||
|
||||
default_button_classnames = ['button']
|
||||
add_button_classnames = ['bicolor', 'icon', 'icon-plus']
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.contrib.contenttypes.models import ContentType
|
|||
from wagtail.core.models import Page, UserPagePermissionsProxy
|
||||
|
||||
|
||||
class PermissionHelper(object):
|
||||
class PermissionHelper:
|
||||
"""
|
||||
Provides permission-related helper functions to help determine what a
|
||||
user can do with a 'typical' model (where permissions are granted
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.utils.functional import cached_property
|
|||
from django.utils.http import urlquote
|
||||
|
||||
|
||||
class AdminURLHelper(object):
|
||||
class AdminURLHelper:
|
||||
|
||||
def __init__(self, model):
|
||||
self.model = model
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe
|
|||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
class ThumbnailMixin(object):
|
||||
class ThumbnailMixin:
|
||||
"""
|
||||
Mixin class to help display thumbnail images in ModelAdmin listing results.
|
||||
`thumb_image_field_name` must be overridden to name a ForeignKey field on
|
||||
|
|
|
@ -15,7 +15,7 @@ from .mixins import ThumbnailMixin # NOQA
|
|||
from .views import ChooseParentView, CreateView, DeleteView, EditView, IndexView, InspectView
|
||||
|
||||
|
||||
class WagtailRegisterable(object):
|
||||
class WagtailRegisterable:
|
||||
"""
|
||||
Base class, providing a more convenient way for ModelAdmin or
|
||||
ModelAdminGroup instances to be registered with Wagtail's admin area.
|
||||
|
|
|
@ -21,7 +21,7 @@ from .utils import (
|
|||
# TODO: Add autocomplete.
|
||||
|
||||
|
||||
class Index(object):
|
||||
class Index:
|
||||
def __init__(self, backend, model, db_alias=None):
|
||||
self.backend = backend
|
||||
self.model = model
|
||||
|
|
|
@ -29,7 +29,7 @@ def route(pattern, name=None):
|
|||
return decorator
|
||||
|
||||
|
||||
class RoutablePageMixin(object):
|
||||
class RoutablePageMixin:
|
||||
"""
|
||||
This class can be mixed in to a Page model, allowing extra routes to be
|
||||
added to it.
|
||||
|
|
|
@ -133,7 +133,7 @@ class TestRoutablePage(TestCase):
|
|||
# This descriptor pretends that it does not exist in the class, hence
|
||||
# it raises an AttributeError when class bound. This is, for instance,
|
||||
# the behavior of django's FileFields.
|
||||
class InstanceDescriptor(object):
|
||||
class InstanceDescriptor:
|
||||
def __get__(self, instance, cls=None):
|
||||
if instance is None:
|
||||
raise AttributeError
|
||||
|
|
|
@ -42,7 +42,7 @@ class Block(metaclass=BaseBlock):
|
|||
|
||||
TEMPLATE_VAR = 'value'
|
||||
|
||||
class Meta(object):
|
||||
class Meta:
|
||||
label = None
|
||||
icon = "placeholder"
|
||||
classname = None
|
||||
|
@ -402,7 +402,7 @@ class Block(metaclass=BaseBlock):
|
|||
return not self.__eq__(other)
|
||||
|
||||
|
||||
class BoundBlock(object):
|
||||
class BoundBlock:
|
||||
def __init__(self, block, value, prefix=None, errors=None):
|
||||
self.block = block
|
||||
self.value = value
|
||||
|
|
|
@ -21,7 +21,7 @@ class RichTextField(models.TextField):
|
|||
|
||||
|
||||
# https://github.com/django/django/blob/64200c14e0072ba0ffef86da46b2ea82fd1e019a/django/db/models/fields/subclassing.py#L31-L44
|
||||
class Creator(object):
|
||||
class Creator:
|
||||
"""
|
||||
A placeholder class that provides a way to set the attribute on the model.
|
||||
"""
|
||||
|
|
|
@ -1562,7 +1562,7 @@ class GroupPagePermission(models.Model):
|
|||
)
|
||||
|
||||
|
||||
class UserPagePermissionsProxy(object):
|
||||
class UserPagePermissionsProxy:
|
||||
"""Helper object that encapsulates all the page permission rules that this user has
|
||||
across the page hierarchy."""
|
||||
def __init__(self, user):
|
||||
|
@ -1648,7 +1648,7 @@ class UserPagePermissionsProxy(object):
|
|||
return self.publishable_pages().exists()
|
||||
|
||||
|
||||
class PagePermissionTester(object):
|
||||
class PagePermissionTester:
|
||||
def __init__(self, user_perms, page):
|
||||
self.user = user_perms.user
|
||||
self.user_perms = user_perms
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.db.models import Q
|
|||
from django.utils.functional import cached_property
|
||||
|
||||
|
||||
class BasePermissionPolicy(object):
|
||||
class BasePermissionPolicy:
|
||||
"""
|
||||
A 'permission policy' is an object that handles all decisions about the actions
|
||||
users are allowed to perform on a given model. The mechanism by which it does this
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.core.models import Collection, GroupCollectionPermission
|
|||
from .base import BaseDjangoAuthPermissionPolicy
|
||||
|
||||
|
||||
class CollectionPermissionLookupMixin(object):
|
||||
class CollectionPermissionLookupMixin:
|
||||
def _get_permission_objects_for_actions(self, actions):
|
||||
"""
|
||||
Get a queryset of the Permission objects for the given actions
|
||||
|
|
|
@ -15,7 +15,7 @@ from wagtail.core.whitelist import Whitelister
|
|||
# to DB representation and back again.
|
||||
|
||||
|
||||
class PageLinkHandler(object):
|
||||
class PageLinkHandler:
|
||||
"""
|
||||
PageLinkHandler will be invoked whenever we encounter an <a> element in HTML content
|
||||
with an attribute of data-linktype="page". The resulting element in the database
|
||||
|
@ -179,7 +179,7 @@ def expand_db_html(html, for_editor=False):
|
|||
return html
|
||||
|
||||
|
||||
class RichText(object):
|
||||
class RichText:
|
||||
"""
|
||||
A custom object used to represent a renderable rich text value.
|
||||
Provides a 'source' property to access the original source code,
|
||||
|
@ -200,7 +200,7 @@ class RichText(object):
|
|||
__nonzero__ = __bool__
|
||||
|
||||
|
||||
class FeatureRegistry(object):
|
||||
class FeatureRegistry:
|
||||
"""
|
||||
A central store of information about optional features that can be enabled in rich text
|
||||
editors by passing a ``features`` list to the RichTextField, such as how to
|
||||
|
|
|
@ -181,7 +181,7 @@ class TestFieldBlock(WagtailTestUtils, SimpleTestCase):
|
|||
Actual real-world use case: A Youtube field that produces YoutubeVideo
|
||||
instances from IDs, but videos are entered using their full URLs.
|
||||
"""
|
||||
class PrefixWrapper(object):
|
||||
class PrefixWrapper:
|
||||
prefix = 'http://example.com/'
|
||||
|
||||
def __init__(self, value):
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.images.models import Image
|
|||
from wagtail.images.tests.utils import get_test_image_file
|
||||
|
||||
|
||||
class PermissionPolicyTestUtils(object):
|
||||
class PermissionPolicyTestUtils:
|
||||
def assertResultSetEqual(self, actual, expected):
|
||||
self.assertEqual(set(actual), set(expected))
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
class RouteResult(object):
|
||||
class RouteResult:
|
||||
"""
|
||||
An object to be returned from Page.route, which encapsulates
|
||||
all the information necessary to serve an HTTP response. Analogous to
|
||||
|
|
|
@ -63,7 +63,7 @@ def attribute_rule(allowed_attrs):
|
|||
allow_without_attributes = attribute_rule({})
|
||||
|
||||
|
||||
class Whitelister(object):
|
||||
class Whitelister:
|
||||
element_rules = {
|
||||
'[document]': allow_without_attributes,
|
||||
'a': attribute_rule({'href': check_url}),
|
||||
|
|
|
@ -11,7 +11,7 @@ class BaseDocumentChooserPanel(BaseChooserPanel):
|
|||
return {cls.field_name: AdminDocumentChooser}
|
||||
|
||||
|
||||
class DocumentChooserPanel(object):
|
||||
class DocumentChooserPanel:
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ from django.utils.html import escape
|
|||
from wagtail.documents.models import get_document_model
|
||||
|
||||
|
||||
class DocumentLinkHandler(object):
|
||||
class DocumentLinkHandler:
|
||||
@staticmethod
|
||||
def get_db_attributes(tag):
|
||||
return {'id': tag['data-id']}
|
||||
|
|
|
@ -2,7 +2,7 @@ from wagtail.core import blocks
|
|||
from wagtail.embeds.format import embed_to_frontend_html
|
||||
|
||||
|
||||
class EmbedValue(object):
|
||||
class EmbedValue:
|
||||
"""
|
||||
Native value of an EmbedBlock. Should, at minimum, have a 'url' property
|
||||
and render as the embed HTML when rendered in a template.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
class EmbedFinder(object):
|
||||
class EmbedFinder:
|
||||
def accept(self, url):
|
||||
return False
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ from wagtail.embeds import format
|
|||
from wagtail.embeds.exceptions import EmbedException
|
||||
|
||||
|
||||
class MediaEmbedHandler(object):
|
||||
class MediaEmbedHandler:
|
||||
"""
|
||||
MediaEmbedHandler will be invoked whenever we encounter an element in HTML content
|
||||
with an attribute of data-embedtype="media". The resulting element in the database
|
||||
|
|
|
@ -300,7 +300,7 @@ class TestEmbedly(TestCase):
|
|||
|
||||
class TestOembed(TestCase):
|
||||
def setUp(self):
|
||||
class DummyResponse(object):
|
||||
class DummyResponse:
|
||||
def read(self):
|
||||
return b"foo"
|
||||
self.dummy_response = DummyResponse()
|
||||
|
|
|
@ -18,7 +18,7 @@ class BaseImageChooserPanel(BaseChooserPanel):
|
|||
return ImageFieldComparison
|
||||
|
||||
|
||||
class ImageChooserPanel(object):
|
||||
class ImageChooserPanel:
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.utils.apps import get_app_submodules
|
|||
from .shortcuts import get_rendition_or_not_found
|
||||
|
||||
|
||||
class Format(object):
|
||||
class Format:
|
||||
def __init__(self, name, label, classnames, filter_spec):
|
||||
self.name = name
|
||||
self.label = label
|
||||
|
|
|
@ -4,7 +4,7 @@ from wagtail.images.exceptions import InvalidFilterSpecError
|
|||
from wagtail.images.rect import Rect
|
||||
|
||||
|
||||
class Operation(object):
|
||||
class Operation:
|
||||
def __init__(self, method, *args):
|
||||
self.method = method
|
||||
self.args = args
|
||||
|
|
|
@ -328,7 +328,7 @@ class Image(AbstractImage):
|
|||
)
|
||||
|
||||
|
||||
class Filter(object):
|
||||
class Filter:
|
||||
"""
|
||||
Represents one or more operations that can be applied to an Image to produce a rendition
|
||||
appropriate for final display on the website. Usually this would be a resize operation,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import math
|
||||
|
||||
|
||||
class Vector(object):
|
||||
class Vector:
|
||||
def __init__(self, x, y):
|
||||
self.x = x
|
||||
self.y = y
|
||||
|
@ -24,7 +24,7 @@ class Vector(object):
|
|||
)
|
||||
|
||||
|
||||
class Rect(object):
|
||||
class Rect:
|
||||
def __init__(self, left, top, right, bottom):
|
||||
self.left = left
|
||||
self.top = top
|
||||
|
|
|
@ -2,7 +2,7 @@ from wagtail.images import get_image_model
|
|||
from wagtail.images.formats import get_image_format
|
||||
|
||||
|
||||
class ImageEmbedHandler(object):
|
||||
class ImageEmbedHandler:
|
||||
"""
|
||||
ImageEmbedHandler will be invoked whenever we encounter an element in HTML content
|
||||
with an attribute of data-embedtype="image". The resulting element in the database
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.images.models import Filter, Image
|
|||
from wagtail.images.tests.utils import get_test_image_file, get_test_image_file_jpeg
|
||||
|
||||
|
||||
class WillowOperationRecorder(object):
|
||||
class WillowOperationRecorder:
|
||||
"""
|
||||
This class pretends to be a Willow image but instead, it records
|
||||
the operations that have been performed on the image for testing
|
||||
|
|
|
@ -14,7 +14,7 @@ class FieldError(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class BaseSearchQuery(object):
|
||||
class BaseSearchQuery:
|
||||
DEFAULT_OPERATOR = 'or'
|
||||
|
||||
def __init__(self, queryset, query_string, fields=None, operator=None, order_by_relevance=True):
|
||||
|
@ -92,7 +92,7 @@ class BaseSearchQuery(object):
|
|||
return self._get_filters_from_where_node(self.queryset.query.where)
|
||||
|
||||
|
||||
class BaseSearchResults(object):
|
||||
class BaseSearchResults:
|
||||
def __init__(self, backend, query, prefetch_related=None):
|
||||
self.backend = backend
|
||||
self.query = query
|
||||
|
@ -197,7 +197,7 @@ class EmptySearchResults(BaseSearchResults):
|
|||
return 0
|
||||
|
||||
|
||||
class BaseSearchBackend(object):
|
||||
class BaseSearchBackend:
|
||||
query_class = None
|
||||
results_class = None
|
||||
rebuilder_class = None
|
||||
|
|
|
@ -40,7 +40,7 @@ def get_model_root(model):
|
|||
return model
|
||||
|
||||
|
||||
class Elasticsearch2Mapping(object):
|
||||
class Elasticsearch2Mapping:
|
||||
type_map = {
|
||||
'AutoField': 'integer',
|
||||
'BinaryField': 'binary',
|
||||
|
@ -619,7 +619,7 @@ class Elasticsearch2SearchResults(BaseSearchResults):
|
|||
return max(hit_count, 0)
|
||||
|
||||
|
||||
class Elasticsearch2Index(object):
|
||||
class Elasticsearch2Index:
|
||||
def __init__(self, backend, name):
|
||||
self.backend = backend
|
||||
self.es = backend.es
|
||||
|
@ -739,7 +739,7 @@ class Elasticsearch2Index(object):
|
|||
self.put()
|
||||
|
||||
|
||||
class ElasticsearchIndexRebuilder(object):
|
||||
class ElasticsearchIndexRebuilder:
|
||||
def __init__(self, index):
|
||||
self.index = index
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ from wagtail.search.backends import get_search_backends_with_name
|
|||
logger = logging.getLogger('wagtail.search.index')
|
||||
|
||||
|
||||
class Indexed(object):
|
||||
class Indexed:
|
||||
@classmethod
|
||||
def indexed_get_parent(cls, require_model=True):
|
||||
for base in cls.__bases__:
|
||||
|
@ -161,7 +161,7 @@ def remove_object(instance):
|
|||
logger.exception("Exception raised while deleting %r from the '%s' search backend", indexed_instance, backend_name)
|
||||
|
||||
|
||||
class BaseField(object):
|
||||
class BaseField:
|
||||
def __init__(self, field_name, **kwargs):
|
||||
self.field_name = field_name
|
||||
self.kwargs = kwargs
|
||||
|
@ -224,7 +224,7 @@ class FilterField(BaseField):
|
|||
pass
|
||||
|
||||
|
||||
class RelatedFields(object):
|
||||
class RelatedFields:
|
||||
def __init__(self, field_name, fields):
|
||||
self.field_name = field_name
|
||||
self.fields = fields
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from wagtail.search.backends import get_search_backend
|
||||
|
||||
|
||||
class SearchableQuerySetMixin(object):
|
||||
class SearchableQuerySetMixin:
|
||||
def search(self, query_string, fields=None,
|
||||
operator=None, order_by_relevance=True, backend='default'):
|
||||
"""
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.core import management
|
|||
from wagtail.tests.search import models
|
||||
|
||||
|
||||
class ElasticsearchCommonSearchBackendTests(object):
|
||||
class ElasticsearchCommonSearchBackendTests:
|
||||
def test_search_with_spaces_only(self):
|
||||
# Search for some space characters and hope it doesn't crash
|
||||
results = self.backend.search(" ", models.Book)
|
||||
|
|
|
@ -30,7 +30,7 @@ class BaseSnippetChooserPanel(BaseChooserPanel):
|
|||
}))
|
||||
|
||||
|
||||
class SnippetChooserPanel(object):
|
||||
class SnippetChooserPanel:
|
||||
def __init__(self, field_name):
|
||||
self.field_name = field_name
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from collections import namedtuple
|
|||
# Implementation of TestCase.assertLogs for pre-3.4 Python versions.
|
||||
# Borrowed from https://github.com/django/django/pull/3467/commits/1b4f10963628bb68246c193f1124a1f7b6e4c696
|
||||
|
||||
class _BaseTestCaseContext(object):
|
||||
class _BaseTestCaseContext:
|
||||
def __init__(self, test_case):
|
||||
self.test_case = test_case
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ from django.utils.text import slugify
|
|||
from wagtail.tests.assert_logs import _AssertLogsContext
|
||||
|
||||
|
||||
class WagtailTestUtils(object):
|
||||
class WagtailTestUtils:
|
||||
|
||||
@staticmethod
|
||||
def create_test_user():
|
||||
|
|
|
@ -19,7 +19,7 @@ def get_permission_panel_classes():
|
|||
return _permission_panel_classes
|
||||
|
||||
|
||||
class PermissionPanelFormsMixin(object):
|
||||
class PermissionPanelFormsMixin:
|
||||
def get_permission_panel_form_kwargs(self, cls):
|
||||
kwargs = {}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class cached_classmethod(dict):
|
|||
"""
|
||||
Cache the result of a no-arg class method.
|
||||
.. code-block:: python
|
||||
class Foo(object):
|
||||
class Foo:
|
||||
@cached_classmethod
|
||||
def bar(cls):
|
||||
# Some expensive computation
|
||||
|
@ -35,7 +35,7 @@ class cached_classmethod(dict):
|
|||
return value
|
||||
|
||||
|
||||
class _cache(object):
|
||||
class _cache:
|
||||
""" Calls the real class method behind when called, caching the result """
|
||||
def __init__(self, cache, cls, fn):
|
||||
self.cache = cache
|
||||
|
|
|
@ -10,7 +10,7 @@ from setuptools.command.sdist import sdist as base_sdist
|
|||
from wagtail import __semver__
|
||||
|
||||
|
||||
class assets_mixin(object):
|
||||
class assets_mixin:
|
||||
|
||||
def compile_assets(self):
|
||||
try:
|
||||
|
|
Ładowanie…
Reference in New Issue