Skip to content

Commit fe2f16b

Browse files
authored
Fix for Wagtail 5.0; update test matrix to use all supported wagtail … (#601)
We had made a change that was only availalbe in Wagtail 5.1, not 5.0. * Fixing that by using the minimum API for all versions. * Add all supported versions of wagtail to the test matrix.
1 parent c48608a commit fe2f16b

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

azure-pipelines.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,21 @@ stages:
3131
vmImage: 'ubuntu-latest'
3232
strategy:
3333
matrix:
34-
py3.8:
34+
py3.8_wag5.0:
3535
PYTHON_VERSION: '3.8'
36-
py3.9:
36+
WAGTAIL_VERSION: '5.0.*'
37+
py3.9_wag5.0:
3738
PYTHON_VERSION: '3.9'
38-
py3.10:
39+
WAGTAIL_VERSION: '5.0.*'
40+
py3.10_wag5.0:
3941
PYTHON_VERSION: '3.10'
40-
py3.11:
42+
WAGTAIL_VERSION: '5.0.*'
43+
py3.11_wag5.1:
4144
PYTHON_VERSION: '3.11'
42-
py3.12:
45+
WAGTAIL_VERSION: '5.1.*'
46+
py3.12_wag5.2:
4347
PYTHON_VERSION: '3.12'
48+
WAGTAIL_VERSION: '5.2.*'
4449

4550
steps:
4651
- task: UsePythonVersion@0
@@ -49,7 +54,7 @@ stages:
4954
versionSpec: '$(PYTHON_VERSION)'
5055
architecture: 'x64'
5156

52-
- script: python -m pip install -r requirements-ci.txt
57+
- script: python -m pip install -r requirements-ci.txt wagtail==$(WAGTAIL_VERSION)
5358
displayName: 'CR-QC: Install coderedcms from local repo'
5459

5560
- script: coderedcms start testproject

coderedcms/wagtail_hooks.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from wagtail.admin.menu import MenuItem
1010
from wagtail import hooks
1111
from wagtail.models import get_page_models
12-
from wagtail.permission_policies.pages import PagePermissionPolicy
12+
from wagtail.models import UserPagePermissionsProxy
1313
from wagtailcache.cache import clear_cache
1414

1515
from coderedcms import __version__
@@ -95,10 +95,7 @@ def crx_forms(user, editable_forms):
9595
if issubclass(model, CoderedFormMixin)
9696
]
9797
form_types = list(ContentType.objects.get_for_models(*form_models).values())
98-
99-
editable_forms = PagePermissionPolicy().instances_user_has_permission_for(
100-
user, "change"
101-
)
98+
editable_forms = UserPagePermissionsProxy(user).editable_pages()
10299
editable_forms = editable_forms.filter(content_type__in=form_types)
103100

104101
return editable_forms

0 commit comments

Comments
 (0)