Viktor Szépe 1 年之前
父節點
當前提交
5679b30d1b
共有 33 個文件被更改,包括 49 次插入49 次删除
  1. 1 1
      CHANGELOG.txt
  2. 1 1
      client/tests/stubs.js
  3. 1 1
      wagtail/admin/compare.py
  4. 1 1
      wagtail/admin/panels/comment_panel.py
  5. 1 1
      wagtail/admin/panels/field_panel.py
  6. 3 3
      wagtail/admin/tests/pages/test_create_page.py
  7. 4 4
      wagtail/admin/tests/pages/test_edit_page.py
  8. 1 1
      wagtail/admin/tests/pages/test_move_page.py
  9. 1 1
      wagtail/admin/tests/test_compare.py
  10. 2 2
      wagtail/admin/tests/test_edit_handlers.py
  11. 1 1
      wagtail/admin/tests/test_workflows.py
  12. 2 2
      wagtail/admin/views/chooser.py
  13. 1 1
      wagtail/api/v2/filters.py
  14. 1 1
      wagtail/api/v2/tests/test_pages.py
  15. 2 2
      wagtail/blocks/base.py
  16. 1 1
      wagtail/contrib/redirects/signal_handlers.py
  17. 1 1
      wagtail/contrib/redirects/tests/test_import_command.py
  18. 2 2
      wagtail/contrib/redirects/tests/test_redirects.py
  19. 1 1
      wagtail/contrib/settings/tests/site_specific/test_admin.py
  20. 3 3
      wagtail/contrib/settings/tests/site_specific/test_model.py
  21. 1 1
      wagtail/contrib/settings/tests/site_specific/test_templates.py
  22. 2 2
      wagtail/contrib/simple_translation/tests/test_wagtail_hooks.py
  23. 1 1
      wagtail/contrib/table_block/blocks.py
  24. 1 1
      wagtail/images/models.py
  25. 1 1
      wagtail/images/tests/test_models.py
  26. 1 1
      wagtail/images/tests/utils.py
  27. 1 1
      wagtail/models/i18n.py
  28. 1 1
      wagtail/models/reference_index.py
  29. 2 2
      wagtail/sites/tests.py
  30. 2 2
      wagtail/snippets/tests/test_snippets.py
  31. 1 1
      wagtail/test/demosite/models.py
  32. 2 2
      wagtail/tests/test_utils.py
  33. 2 2
      wagtail/users/tests/test_admin_views.py

+ 1 - 1
CHANGELOG.txt

@@ -1344,7 +1344,7 @@ Changelog
  * Fix: Layout issue with page explorer's inner header item on small device widths (Akash Kumar Sen)
  * Fix: Ensure that `BaseSiteSetting` / `BaseGenericSetting` objects can be pickled (Andy Babic)
  * Fix: Ensure `DocumentChooserBlock` can be deconstructed for migrations (Matt Westcott)
- * Fix: Resolve frontend console error and unintented console logging issues (Matt Westcott, Paarth Agarwal)
+ * Fix: Resolve frontend console error and unintended console logging issues (Matt Westcott, Paarth Agarwal)
  * Fix: Resolve issue with sites that have not yet migrated away from `BaseSetting` when upgrading to Wagtail 4.0 (Stefan Hammer)
  * Fix: Use correct classnames for showing/hiding edit button on chooser widget (Matt Westcott)
  * Fix: Render MultiFieldPanel’s heading even when nested (Thibaud Colas)

+ 1 - 1
client/tests/stubs.js

@@ -30,7 +30,7 @@ global.wagtailConfig = {
     },
     {
       code: 'fr',
-      display_nam: 'French',
+      display_name: 'French',
     },
   ],
   ACTIVE_LOCALE: 'en',

+ 1 - 1
wagtail/admin/compare.py

@@ -511,7 +511,7 @@ class ChildRelationComparison:
             # Relations don't have a verbose_name
             if self.label:
                 # If the panel has a label, we set it instead.
-                # See InlinePanel.get_comparision for usage
+                # See InlinePanel.get_comparison for usage
                 verbose_name = self.label
             else:
                 verbose_name = self.field.name.replace("_", " ")

+ 1 - 1
wagtail/admin/panels/comment_panel.py

@@ -28,7 +28,7 @@ class CommentPanel(Panel):
 
     @property
     def clean_name(self):
-        return super().clean_name or "commments"
+        return super().clean_name or "comments"
 
     class BoundPanel(Panel.BoundPanel):
         template_name = "wagtailadmin/panels/comments/comment_panel.html"

+ 1 - 1
wagtail/admin/panels/field_panel.py

@@ -168,7 +168,7 @@ class FieldPanel(Panel):
                     )
                 return
 
-            # Ensure heading and help_text are consistant accross
+            # Ensure heading and help_text are consistent across
             # Panel, BoundPanel and Field
             if self.panel.heading:
                 self.heading = self.bound_field.label = self.panel.heading

+ 3 - 3
wagtail/admin/tests/pages/test_create_page.py

@@ -1806,7 +1806,7 @@ class TestPageSubscriptionSettings(WagtailTestUtils, TestCase):
         # Login
         self.user = self.login()
 
-    def test_commment_notifications_switched_on_by_default(self):
+    def test_comment_notifications_switched_on_by_default(self):
         response = self.client.get(
             reverse(
                 "wagtailadmin_pages:add",
@@ -1890,7 +1890,7 @@ class TestCommenting(WagtailTestUtils, TestCase):
         # Login
         self.user = self.login()
 
-    def test_commments_enabled_by_default(self):
+    def test_comments_enabled_by_default(self):
         response = self.client.get(
             reverse(
                 "wagtailadmin_pages:add",
@@ -1907,7 +1907,7 @@ class TestCommenting(WagtailTestUtils, TestCase):
         self.assertEqual("w-comments:init", form["data-w-init-event-value"])
 
     @override_settings(WAGTAILADMIN_COMMENTS_ENABLED=False)
-    def test_commments_disabled(self):
+    def test_comments_disabled(self):
         response = self.client.get(
             reverse(
                 "wagtailadmin_pages:add",

+ 4 - 4
wagtail/admin/tests/pages/test_edit_page.py

@@ -3088,7 +3088,7 @@ class TestPageSubscriptionSettings(WagtailTestUtils, TestCase):
         # Login
         self.user = self.login()
 
-    def test_commment_notifications_switched_off(self):
+    def test_comment_notifications_switched_off(self):
         response = self.client.get(
             reverse("wagtailadmin_pages:edit", args=[self.child_page.id])
         )
@@ -3104,7 +3104,7 @@ class TestPageSubscriptionSettings(WagtailTestUtils, TestCase):
             ).exists()
         )
 
-    def test_commment_notifications_switched_on(self):
+    def test_comment_notifications_switched_on(self):
         PageSubscription.objects.create(
             page=self.child_page, user=self.user, comment_notifications=True
         )
@@ -3247,7 +3247,7 @@ class TestCommenting(WagtailTestUtils, TestCase):
             [to for email in mail.outbox for to in email.to],
         )
 
-    def test_commments_enabled_by_default(self):
+    def test_comments_enabled_by_default(self):
         response = self.client.get(
             reverse("wagtailadmin_pages:edit", args=[self.child_page.id])
         )
@@ -3261,7 +3261,7 @@ class TestCommenting(WagtailTestUtils, TestCase):
         self.assertEqual("w-comments:init", form["data-w-init-event-value"])
 
     @override_settings(WAGTAILADMIN_COMMENTS_ENABLED=False)
-    def test_commments_disabled(self):
+    def test_comments_disabled(self):
         response = self.client.get(
             reverse("wagtailadmin_pages:edit", args=[self.child_page.id])
         )

+ 1 - 1
wagtail/admin/tests/pages/test_move_page.py

@@ -243,7 +243,7 @@ class TestPageMove(WagtailTestUtils, TestCase):
 
     def test_page_move_after_parent_page_types_changes_to_different_parent_model(self):
         # Test for issue #10348
-        # While BusinesSubIndex cannot be created under a SimplePage, we can
+        # While BusinessSubIndex cannot be created under a SimplePage, we can
         # still create it under a SimplePage invoking django-treebeard's add_child
         # which works great for our purposes.
         self.assertFalse(BusinessSubIndex.can_exist_under(self.section_a))

+ 1 - 1
wagtail/admin/tests/test_compare.py

@@ -1228,7 +1228,7 @@ class TestChildRelationComparison(TestCase):
     def test_has_changed(self):
         # Father Christmas renamed to Santa Claus. And Father Ted added.
         # Father Christmas should be mapped to Father Ted because they
-        # are most alike. Santa claus should be displayed as "new"
+        # are most alike. Santa Claus should be displayed as "new"
         event_page = EventPage(title="Event page", slug="event")
         event_page.speakers.add(
             EventPageSpeaker(

+ 2 - 2
wagtail/admin/tests/test_edit_handlers.py

@@ -189,7 +189,7 @@ class TestGetFormForModel(TestCase):
         self.assertIn("speakers", form.formsets)
         self.assertNotIn("related_links", form.formsets)
 
-    def test_get_form_for_model_with_widget_overides_by_class(self):
+    def test_get_form_for_model_with_widget_overrides_by_class(self):
         EventPageForm = get_form_for_model(
             EventPage,
             form_class=WagtailAdminPageForm,
@@ -201,7 +201,7 @@ class TestGetFormForModel(TestCase):
         self.assertEqual(type(form.fields["date_from"]), forms.DateField)
         self.assertEqual(type(form.fields["date_from"].widget), forms.PasswordInput)
 
-    def test_get_form_for_model_with_widget_overides_by_instance(self):
+    def test_get_form_for_model_with_widget_overrides_by_instance(self):
         EventPageForm = get_form_for_model(
             EventPage,
             form_class=WagtailAdminPageForm,

+ 1 - 1
wagtail/admin/tests/test_workflows.py

@@ -3721,7 +3721,7 @@ class TestWorkflowStateEmailNotifier(BasePageWorkflowTests):
                     notifier.get_recipient_users(workflow_state), {self.submitter}
                 )
 
-    def test_workflowstate_email_notifier_get_recipient_users__with_trigerring_user(
+    def test_workflowstate_email_notifier_get_recipient_users__with_triggering_user(
         self
     ):
         self.workflow.start(self.object, user=self.submitter)

+ 2 - 2
wagtail/admin/views/chooser.py

@@ -342,7 +342,7 @@ class BrowseView(View):
                         }
                     )
 
-            # finally, filter the browseable pages on the selected locale
+            # finally, filter the browsable pages on the selected locale
             if selected_locale:
                 pages = pages.filter(locale=selected_locale)
 
@@ -355,7 +355,7 @@ class BrowseView(View):
         except InvalidPage:
             raise Http404
 
-        # Annotate each page with can_choose/can_decend flags
+        # Annotate each page with can_choose/can_descend flags
         for page in pages:
             page.can_choose = can_choose_page(
                 page,

+ 1 - 1
wagtail/api/v2/filters.py

@@ -221,7 +221,7 @@ class AncestorOfFilter(BaseFilterBackend):
 
 class DescendantOfFilter(BaseFilterBackend):
     """
-    Implements the ?decendant_of filter which limits the set of pages to a
+    Implements the ?descendant_of filter which limits the set of pages to a
     particular branch of the page tree.
     """
 

+ 1 - 1
wagtail/api/v2/tests/test_pages.py

@@ -197,7 +197,7 @@ class TestPageListing(WagtailTestUtils, TestCase):
         self.assertTrue(blog_page_seen, msg="No blog pages were found in the items")
         self.assertTrue(event_page_seen, msg="No event pages were found in the items")
 
-    def test_non_existant_type_gives_error(self):
+    def test_non_existent_type_gives_error(self):
         response = self.get_response(type="demosite.IDontExist")
         content = json.loads(response.content.decode("UTF-8"))
 

+ 2 - 2
wagtail/blocks/base.py

@@ -144,7 +144,7 @@ class Block(metaclass=BaseBlock):
         converted to the value type expected by this block. This caters for the case
         where that value type is not something that can be expressed statically at
         model definition type (e.g. something like StructValue which incorporates a
-        pointer back to the block definion object).
+        pointer back to the block definition object).
         """
         return self.meta.default
 
@@ -215,7 +215,7 @@ class Block(metaclass=BaseBlock):
         Return the template to use for rendering the block if specified on meta class.
         This extraction was added to make dynamic templates possible if you override this method
 
-        value contains the current value of the block, allowing overriden methods to
+        value contains the current value of the block, allowing overridden methods to
         select the proper template based on the actual block value.
         """
         return getattr(self.meta, "template", None)

+ 1 - 1
wagtail/contrib/redirects/signal_handlers.py

@@ -134,7 +134,7 @@ def create_redirects(page: Page, page_old: Page, sites: Iterable[Site]) -> None:
     # For bulk-creating redirects in batches
     batch = BatchRedirectCreator(max_size=2000, ignore_conflicts=True)
 
-    # Treat the page that was updated / moved separately to it's decendants,
+    # Treat the page that was updated / moved separately to it's descendants,
     # because there may be changes to fields other than `slug` or `url_path`
     # that impact the URL.
     old_urls = _page_urls_for_sites(page_old, sites, cache_target=page)

+ 1 - 1
wagtail/contrib/redirects/tests/test_import_command.py

@@ -241,7 +241,7 @@ class TestImportCommand(TestCase):
         "wagtail.contrib.redirects.management.commands.import_redirects.get_input",
         return_value="Y",
     )
-    def test_successfull_ask_imports_redirect(self, get_input):
+    def test_successful_ask_imports_redirect(self, get_input):
         invalid_file = tempfile.NamedTemporaryFile(mode="w+", encoding="utf-8")
         invalid_file.write("from,to\n")
         invalid_file.write("/alpha,http://omega.test/")

+ 2 - 2
wagtail/contrib/redirects/tests/test_redirects.py

@@ -810,7 +810,7 @@ class TestRedirectsEditView(WagtailTestUtils, TestCase):
         expected_url = "/admin/redirects/%d/" % self.redirect.id
         self.assertEqual(url_finder.get_edit_url(self.redirect), expected_url)
 
-    def test_nonexistant_redirect(self):
+    def test_nonexistent_redirect(self):
         self.assertEqual(self.get(redirect_id=100000).status_code, 404)
 
     def test_edit(self):
@@ -914,7 +914,7 @@ class TestRedirectsDeleteView(WagtailTestUtils, TestCase):
         self.assertEqual(response.status_code, 200)
         self.assertTemplateUsed(response, "wagtailredirects/confirm_delete.html")
 
-    def test_nonexistant_redirect(self):
+    def test_nonexistent_redirect(self):
         self.assertEqual(self.get(redirect_id=100000).status_code, 404)
 
     def test_delete(self):

+ 1 - 1
wagtail/contrib/settings/tests/site_specific/test_admin.py

@@ -120,7 +120,7 @@ class TestSiteSettingEditView(BaseTestSiteSettingView):
         response = self.get()
         self.assertEqual(response.status_code, 200)
 
-    def test_non_existant_model(self):
+    def test_non_existent_model(self):
         response = self.client.get(
             reverse("wagtailsettings:edit", args=["test", "foo", 1])
         )

+ 3 - 3
wagtail/contrib/settings/tests/site_specific/test_model.py

@@ -74,7 +74,7 @@ class SettingModelTestCase(SiteSettingsTestMixin, TestCase):
     def test_importantpages_object_is_pickleable(self):
         obj = self._create_importantpagessitesetting_object()
         # Triggers creation of the InvokeViaAttributeShortcut instance,
-        # and also gives us a value we can use for comparisson
+        # and also gives us a value we can use for comparison
         signup_page_url = obj.page_url.sign_up_page
 
         # Attempt to pickle ImportantPages instance
@@ -82,7 +82,7 @@ class SettingModelTestCase(SiteSettingsTestMixin, TestCase):
             pickled = pickle.dumps(obj, -1)
         except Exception as e:  # noqa: BLE001
             raise AssertionError(
-                f"An error occured when attempting to pickle {obj!r}: {e}"
+                f"An error occurred when attempting to pickle {obj!r}: {e}"
             )
 
         # Now unpickle the pickled ImportantPages
@@ -90,7 +90,7 @@ class SettingModelTestCase(SiteSettingsTestMixin, TestCase):
             unpickled = pickle.loads(pickled)
         except Exception as e:  # noqa: BLE001
             raise AssertionError(
-                f"An error occured when attempting to unpickle {obj!r}: {e}"
+                f"An error occurred when attempting to unpickle {obj!r}: {e}"
             )
 
         # Using 'page_url' should create a new InvokeViaAttributeShortcut

+ 1 - 1
wagtail/contrib/settings/tests/site_specific/test_templates.py

@@ -174,7 +174,7 @@ class TestTemplateTag(TemplateTestCase):
 
         self.assertEqual(template.render(context), "")
 
-    def test_get_settings_variable_assigment_use_default(self):
+    def test_get_settings_variable_assignment_use_default(self):
         """
         Check that assigning the setting to a context variable with
         {% get_settings use_default_site=True as wagtail_settings %} works.

+ 2 - 2
wagtail/contrib/simple_translation/tests/test_wagtail_hooks.py

@@ -160,7 +160,7 @@ class TestConstructSyncedPageTreeListHook(Utils):
         # Login to access the admin
         self.login()
 
-        # Make sur the French homepage is published/live
+        # Make sure the French homepage is published/live
         self.fr_homepage.live = True
         self.fr_homepage.save()
         self.assertTrue(self.en_homepage.live)
@@ -259,7 +259,7 @@ class TestMovingTranslatedPages(Utils):
         self.assertEqual(self.en_blog_post.get_parent().id, self.en_blog_index.id)
 
         # Confirm the fr and de blog post pages are under the blog index page
-        # We'll confirm these have not moved after ther POST request.
+        # We'll confirm these have not moved after the POST request.
         original_translated_parent_ids = [
             p.id for p in self.en_blog_index.get_translations()
         ]

+ 1 - 1
wagtail/contrib/table_block/blocks.py

@@ -130,7 +130,7 @@ class TableBlock(FieldBlock):
         """
         If value came from a table block stored before Wagtail 6.0, we need to set an appropriate
         value for the header choice. I would really like to have this default to "" and force the
-        editor to reaffirm they don't want any headers, but that woud be a breaking change.
+        editor to reaffirm they don't want any headers, but that would be a breaking change.
         """
         if not value.get("table_header_choice", ""):
             if value.get("first_row_is_table_header", False) and value.get(

+ 1 - 1
wagtail/images/models.py

@@ -557,7 +557,7 @@ class AbstractImage(ImageFileMixin, CollectionMember, index.Indexed, models.Mode
         values (images) reflecting the supplied ``filters`` and the focal point
         values from this object.
 
-        Filters for which an existing rendition cannot be found are ommitted
+        Filters for which an existing rendition cannot be found are omitted
         from the return value. If none of the requested renditions have been
         created before, the return value will be an empty dict.
         """

+ 1 - 1
wagtail/images/tests/test_models.py

@@ -668,7 +668,7 @@ class TestRenditions(TestCase):
         self._test_get_renditions_performance(1)
 
         # ATTEMPT 3
-        # If the existing renditions are prefetched, no futher queries should
+        # If the existing renditions are prefetched, no further queries should
         # be needed, whether that's with prefetch_related("renditions") or
         # prefetch_renditions()
         self._test_get_renditions_performance(0, prefetch_all=True)

+ 1 - 1
wagtail/images/tests/utils.py

@@ -73,7 +73,7 @@ def get_test_image_file_svg(
 
 
 def get_test_bad_image():
-    # Create an image with a missing file, by deserializing fom a python object
+    # Create an image with a missing file, by deserializing from a python object
     # (which bypasses FileField's attempt to read the file)
     return list(
         serializers.deserialize(

+ 1 - 1
wagtail/models/i18n.py

@@ -378,7 +378,7 @@ def bootstrap_translatable_model(model, locale):
     This function populates the "translation_key", and "locale" fields on model instances that were created
     before wagtail-localize was added to the site.
 
-    This can be called from a data migration, or instead you could use the "boostrap_translatable_models"
+    This can be called from a data migration, or instead you could use the "bootstrap_translatable_models"
     management command.
     """
     for instance in (

+ 1 - 1
wagtail/models/reference_index.py

@@ -160,7 +160,7 @@ class ReferenceIndex(models.Model):
     # linked by a ParentalKey.
     tracked_models = set()
 
-    # Ths set of models that can appear as the 'from' object in the reference index.
+    # The set of models that can appear as the 'from' object in the reference index.
     # This only includes those registered with `register_model`, and NOT child models linked
     # by ParentalKey (object references on those are recorded under the parent).
     indexed_models = set()

+ 2 - 2
wagtail/sites/tests.py

@@ -208,7 +208,7 @@ class TestSiteEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
         expected_url = "/admin/sites/edit/%d/" % self.localhost.id
         self.assertEqual(url_finder.get_edit_url(self.localhost), expected_url)
 
-    def test_nonexistant_redirect(self):
+    def test_nonexistent_redirect(self):
         self.assertEqual(self.get(site_id=100000).status_code, 404)
 
     def test_edit(self):
@@ -357,7 +357,7 @@ class TestSiteDeleteView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
         self.assertTemplateUsed(response, "wagtailadmin/generic/confirm_delete.html")
         self.assertBreadcrumbsNotRendered(response.content)
 
-    def test_nonexistant_redirect(self):
+    def test_nonexistent_redirect(self):
         self.assertEqual(self.get(site_id=100000).status_code, 404)
 
     def test_posting_deletes_site(self):

+ 2 - 2
wagtail/snippets/tests/test_snippets.py

@@ -1598,13 +1598,13 @@ class TestSnippetEditView(BaseTestSnippetEditView):
         expected_url = "/admin/snippets/tests/advert/edit/%d/" % self.test_snippet.pk
         self.assertEqual(url_finder.get_edit_url(self.test_snippet), expected_url)
 
-    def test_non_existant_model(self):
+    def test_non_existent_model(self):
         response = self.client.get(
             f"/admin/snippets/tests/foo/edit/{quote(self.test_snippet.pk)}/"
         )
         self.assertEqual(response.status_code, 404)
 
-    def test_nonexistant_id(self):
+    def test_nonexistent_id(self):
         response = self.client.get(
             reverse("wagtailsnippets_tests_advert:edit", args=[999999])
         )

+ 1 - 1
wagtail/test/demosite/models.py

@@ -471,7 +471,7 @@ class EventPage(Page):
 
     def get_event_index(self):
         # Find closest ancestor which is an event index
-        return EventIndexPage.objects.ancester_of(self).last()
+        return EventIndexPage.objects.ancestor_of(self).last()
 
 
 class EventPageCarouselItem(Orderable, AbstractCarouselItem):

+ 2 - 2
wagtail/tests/test_utils.py

@@ -178,14 +178,14 @@ class TestInvokeViaAttributeShortcut(SimpleTestCase):
             pickled = pickle.dumps(self.test_object, -1)
         except Exception as e:  # noqa: BLE001
             raise AssertionError(
-                "An error occured when attempting to pickle %r: %s"
+                "An error occurred when attempting to pickle %r: %s"
                 % (self.test_object, e)
             )
         try:
             self.test_object = pickle.loads(pickled)
         except Exception as e:  # noqa: BLE001
             raise AssertionError(
-                "An error occured when attempting to unpickle %r: %s"
+                "An error occurred when attempting to unpickle %r: %s"
                 % (self.test_object, e)
             )
 

+ 2 - 2
wagtail/users/tests/test_admin_views.py

@@ -852,7 +852,7 @@ class TestUserEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
         expected_url = "/admin/users/%s/" % self.test_user.pk
         self.assertEqual(url_finder.get_edit_url(self.test_user), expected_url)
 
-    def test_nonexistant_redirect(self):
+    def test_nonexistent_redirect(self):
         invalid_id = (
             "99999999-9999-9999-9999-999999999999"
             if settings.AUTH_USER_MODEL == "emailuser.EmailUser"
@@ -1691,7 +1691,7 @@ class TestGroupEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
         with self.assertNumQueries(31):
             self.get()
 
-    def test_nonexistant_group_redirect(self):
+    def test_nonexistent_group_redirect(self):
         self.assertEqual(self.get(group_id=100000).status_code, 404)
 
     def test_group_edit(self):