From 91d0248ae41aca46971e13b6797f9fb0039ed4d8 Mon Sep 17 00:00:00 2001 From: davidu1975 Date: Thu, 25 Jan 2024 21:19:53 +0000 Subject: [PATCH 1/2] fix issue with Page.get_url due to upgrade --- core/models.py | 2 +- .../pages/listing/_page_title_explore.html | 3 +- core/wagtail_hooks.py | 2 +- requirements.in | 74 +++++++++---------- requirements.txt | 6 +- requirements_test.txt | 14 ++-- tests/core/test_wagtail_hooks.py | 2 +- 7 files changed, 52 insertions(+), 51 deletions(-) diff --git a/core/models.py b/core/models.py index 4910e520..3809041d 100644 --- a/core/models.py +++ b/core/models.py @@ -250,7 +250,7 @@ def get_tree_based_url(self, include_site_url=False): def get_url_path_parts(self): return [self.view_path, self.slug + '/'] - def get_url(self, is_draft=False, language_code=settings.LANGUAGE_CODE): + def get_url(self, request=None, is_draft=False, language_code=settings.LANGUAGE_CODE): url = self.full_url querystring = {} if is_draft: diff --git a/core/templates/wagtailadmin/pages/listing/_page_title_explore.html b/core/templates/wagtailadmin/pages/listing/_page_title_explore.html index 8397a82e..ed4b9302 100644 --- a/core/templates/wagtailadmin/pages/listing/_page_title_explore.html +++ b/core/templates/wagtailadmin/pages/listing/_page_title_explore.html @@ -20,5 +20,6 @@

+ diff --git a/core/wagtail_hooks.py b/core/wagtail_hooks.py index 8af5ee4d..9ba3a3a5 100644 --- a/core/wagtail_hooks.py +++ b/core/wagtail_hooks.py @@ -9,7 +9,7 @@ @hooks.register('register_page_listing_more_buttons') -def add_copy_button(page, page_perms, next_url=None, is_parent=False): +def add_copy_button(page, user=None, next_url=None): if isinstance(page, models.BasePage): yield Button( 'Copy upstream', diff --git a/requirements.in b/requirements.in index 5d06c0d4..f9ea322c 100644 --- a/requirements.in +++ b/requirements.in @@ -1,45 +1,45 @@ django==4.2.7 -djangorestframework==3.14.* -django-environ==0.* -gunicorn==20.* -sentry-sdk==1.* -django_storages==1.13.* -whitenoise==6.4.* -dj-database-url==2.* -psycopg2==2.9.* --no-binary psycopg2 -django-pglocks==1.0.* -boto3==1.24.* -sigauth==5.2.4 -directory-healthcheck==3.2 -directory-components==40.* -directory-constants==24.* +django-celery-beat==2.5.0 +django-environ==0.11.2 +django-filter==23.5 +django-modeltranslation==0.18.11 +django-pglocks==1.0.4 +django-redis==5.4.0 +django-storages==1.13.2 +djangorestframework==3.14.0 +wagtail-markdown==0.11.1 +wagtail-modeltranslation==0.14.* +wagtail==5.2.2 +wagtailmedia==0.14.* +directory-components==40.1.1 +directory-constants==24.1.0 +directory-healthcheck==3.3 django-staff-sso-client==4.2.1 -html2text==2020.* -pytube==9.2.2 -django-filter>=2.4.0 -django-redis +notifications-python-client==9.0.0 +sigauth==5.2.4 +bleach-whitelist==0.* +bleach==3.* +boto3==1.24.* celery[redis] -django-celery-beat==2.5.0 +certifi==2023.7.22 +cryptography==41.* +dj-database-url==2.* +drf-spectacular +elastic-apm>6.0 +gevent==23.9.* +gunicorn==20.* +html2text==2020.* kombu==5.3.1 -requests[security]>=2.31.0 markdown==3.* -bleach==3.* -bleach-whitelist==0.* -wagtail==5.2.2 -wagtail-markdown==0.11 -wagtail-modeltranslation==0.14.* -django-modeltranslation==0.18.* -urllib3==1.26.* -w3lib==1.22 -notifications-python-client==6.3.* num2words==0.5.10 -pycountry==19.8.18 -elastic-apm>6.0 -gevent==23.9.* -psycogreen==1.0.2 -wagtailmedia==0.14.* -cryptography==41.* oauthlib==3.2.* -drf-spectacular -certifi==2023.7.22 +psycogreen==1.0.2 +psycopg2==2.9.* --no-binary psycopg2 +pycountry==19.8.18 +pytube==9.2.2 +requests[security]>=2.31.0 +sentry-sdk==1.* +urllib3==1.26.* +w3lib==1.22 +whitenoise==6.4.* willow==1.6.* diff --git a/requirements.txt b/requirements.txt index abad7de6..aef12109 100644 --- a/requirements.txt +++ b/requirements.txt @@ -72,7 +72,7 @@ directory-constants==24.1.0 # via # -r requirements.in # directory-components -directory-healthcheck==3.2 +directory-healthcheck==3.3 # via -r requirements.in dj-database-url==2.1.0 # via -r requirements.in @@ -191,7 +191,7 @@ markdown==3.5.2 # wagtail-markdown mohawk==1.1.0 # via sigauth -notifications-python-client==6.3.0 +notifications-python-client==9.0.0 # via -r requirements.in num2words==0.5.10 # via -r requirements.in @@ -307,7 +307,7 @@ wagtail==5.2.2 # wagtail-markdown # wagtail-modeltranslation # wagtailmedia -wagtail-markdown==0.11.0 +wagtail-markdown==0.11.1 # via -r requirements.in wagtail-modeltranslation==0.14.1 # via -r requirements.in diff --git a/requirements_test.txt b/requirements_test.txt index 2367ad39..712ec09e 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -83,11 +83,11 @@ directory-constants==24.1.0 # via # -r requirements.in # directory-components -directory-healthcheck==3.2 +directory-healthcheck==3.3 # via -r requirements.in dj-database-url==2.1.0 # via -r requirements.in -django==4.2.8 +django==4.2.7 # via # -r requirements.in # directory-components @@ -174,7 +174,7 @@ factory-boy==3.3.0 # via # -r requirements_test.in # wagtail-factories -faker==22.5.0 +faker==22.5.1 # via factory-boy filetype==1.2.0 # via willow @@ -228,7 +228,7 @@ mccabe==0.7.0 # via flake8 mohawk==1.1.0 # via sigauth -notifications-python-client==6.3.0 +notifications-python-client==9.0.0 # via -r requirements.in num2words==0.5.10 # via -r requirements.in @@ -252,7 +252,7 @@ pillow-heif==0.14.0 # via willow pip-tools==7.3.0 # via -r requirements_test.in -pluggy==1.3.0 +pluggy==1.4.0 # via pytest prompt-toolkit==3.0.43 # via click-repl @@ -331,7 +331,7 @@ s3transfer==0.6.2 # via boto3 sentry-sdk==1.39.2 # via -r requirements.in -sigauth==5.2.3 +sigauth==5.2.4 # via -r requirements.in six==1.16.0 # via @@ -400,7 +400,7 @@ wagtail==5.2.2 # wagtailmedia wagtail-factories==4.1.0 # via -r requirements_test.in -wagtail-markdown==0.11.0 +wagtail-markdown==0.11.1 # via -r requirements.in wagtail-modeltranslation==0.14.1 # via -r requirements.in diff --git a/tests/core/test_wagtail_hooks.py b/tests/core/test_wagtail_hooks.py index 7cc285de..8001c7ac 100644 --- a/tests/core/test_wagtail_hooks.py +++ b/tests/core/test_wagtail_hooks.py @@ -8,7 +8,7 @@ @pytest.mark.django_db def test_add_copy_button(page_with_reversion): page = page_with_reversion - buttons = list(wagtail_hooks.add_copy_button(page=page, page_perms=None)) + buttons = list(wagtail_hooks.add_copy_button(page=page)) assert len(buttons) == 2 assert buttons[0].label == 'Copy upstream' From 80ff472f4e005c4e5cccd00cd18c7462b50c662c Mon Sep 17 00:00:00 2001 From: davidu1975 Date: Fri, 26 Jan 2024 09:58:13 +0000 Subject: [PATCH 2/2] add current site to get_url() --- core/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/models.py b/core/models.py index 3809041d..d91fe1a1 100644 --- a/core/models.py +++ b/core/models.py @@ -250,7 +250,7 @@ def get_tree_based_url(self, include_site_url=False): def get_url_path_parts(self): return [self.view_path, self.slug + '/'] - def get_url(self, request=None, is_draft=False, language_code=settings.LANGUAGE_CODE): + def get_url(self, request=None, current_site=None, is_draft=False, language_code=settings.LANGUAGE_CODE): url = self.full_url querystring = {} if is_draft: