fix: update Wagtail to 7.4 LTS#2159
Conversation
|
This test is failing: |
dce1279 to
dc85afb
Compare
dc85afb to
1d9ee51
Compare
|
There are few different errors and failures that I am trying to fix before making it ready for review. One of the errors is caused due to the change in handling of OPTIONS request Wagtail since 6.4. Using hooks, the OPTIONS response is served separately, and actually never reaches our cc-ing @chigby since he might have some thoughts and ideas. |
|
For the Site does not exist errors, it weirdly only happens when all the tests are run, and not when the individual test suites are run. I am trying to look into it to figure out what might be the cause since I don't really see anything in the changelog that should be causing this. Especially since it only happens when all the tests are run together and not individually. I feel like this is happening due to cache pollution or something where the default site gets deleted in between which is why it only happens when the entire test suite is run. The error is happening in the |
- update wagtail from 6.3.8 to 7.4 - update wagtail-factories from 4.1 to 4.4 - update wagtail-honeypot from 1.2 to 1.3 - update wagtail-inventory from 3.1 to 3.3
Wagtail 7.0 introduces [deferred validation](https://docs.wagtail.org/en/stable/releases/7.0.html#deferring-validation-on-saving-drafts) that validates only on publish (or submit or schedule) and requires that non-text fields [add `null=True`](https://docs.wagtail.org/en/stable/releases/7.0.html#configuring-deferred-validation-of-required-fields) to support that on new draft pages. With Wagtail 7.3 and its autosave, this becomes more immediately user-facing.
In Wagtail 7.x, Snippets menu in admin doesn't show the snippets which are added in the menu separately. Setting the above settingsto true shows all snippets in the menu to keep the same behaviour as before.
Two test failures surfaced after the Wagtail 7.4 upgrade: 1. Site.DoesNotExist during template rendering in many tests. The `MetadataPageMixin` now calls `self.get_site()` while rendering meta tags, which resolves the site id via Wagtail's in-process site root paths cache. Test classes that delete the home page (cascading to Site) and create a new one in `setUpTestData` populate that cache with the new Site's id. The class-teardown rollback removes the new Site from the DB but does not fire the signals that would clear the cache, so subsequent tests resolve page URLs against a Site id that no longer exists. Fix: clear the cache after every test in the project's test runner. 2. test_OPTIONS failure on the incident export endpoint. Wagtail 7.4 added a `before_serve_page` hook that intercepts OPTIONS requests before they reach RoutablePageMixin routes, so the custom `export_view_OPTIONS` no longer runs. Override `handle_options_request` on IncidentIndexPage to attach the CORS headers the test (and clients) expect. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
@willbarton I have rebased the PR. Let me know if there is anything else that we should do before merging. |
|
@SaptakS nope, I think it's good! |
Description
Update Wagtail 6.3.8 to 7.4.0
Also update:
Part of https://github.com/freedomofpress/fpf-www-projects/issues/508
Notes from work done by @SaptakS
Changes proposed in this pull request:
Type of change
Testing
Full QA of site.