Skip to content

Commit 74d9685

Browse files
committed
Upgrade Django to 4.2.10
1 parent c4a9dae commit 74d9685

File tree

16 files changed

+87
-90
lines changed

16 files changed

+87
-90
lines changed

checks/probes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
33
from django.conf import settings
4-
from django.utils.translation import ugettext as _
4+
from django.utils.translation import gettext as _
55

66
from checks import categories
77
from checks.categories import MailTlsStarttlsExists, WebTlsHttpsExists

interface/batch/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def get_user_from_request(request):
195195
DB) return the relevant user object from the DB.
196196
197197
"""
198-
username = request.META.get("REMOTE_USER") or request.META.get("HTTP_REMOTE_USER")
198+
username = request.META.get("REMOTE_USER") or request.headers.get("remote-user")
199199
if not username:
200200
username = getattr(settings, "BATCH_TEST_USER", None)
201201
user, created = BatchUser.objects.get_or_create(username=username)

interface/conntesturls/ipv4_urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
3-
from django.conf.urls import url
3+
from django.urls import path
44

55
from interface.views.connection import network_ipv4
66

77
urlpatterns = [
8-
url(r"^$", network_ipv4),
8+
path("", network_ipv4),
99
]

interface/conntesturls/ipv6_urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
3-
from django.conf.urls import url
3+
from django.urls import path
44

55
from interface.views.connection import aaaa_ipv6
66

77
urlpatterns = [
8-
url(r"^$", aaaa_ipv6),
8+
path("", aaaa_ipv6),
99
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
3-
from django.conf.urls import url
3+
from django.urls import path
44

55
from interface.views.connection import network_resolver
66

77
urlpatterns = [
8-
url(r"^$", network_resolver),
8+
path("", network_resolver),
99
]

interface/templatetags/translate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django import template
77
from django.conf import settings
88
from django.template import Template
9-
from django.utils.translation import ugettext as _
9+
from django.utils.translation import gettext as _
1010

1111
from checks.scoring import (
1212
STATUS_ERROR,

interface/urls.py

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
33
from django.conf import settings
4-
from django.conf.urls import url
4+
from django.urls import path, re_path
55
from django.conf.urls.static import static
66

77
from interface import views
@@ -17,118 +17,118 @@
1717
)
1818

1919
urlpatterns = [
20-
url(r"^$", views.indexpage),
21-
url(r"^statistics/(?P<start_date>[0-9]{8})/(?P<end_date>[0-9]{8})/$", stats.statistics),
22-
url(r"^copyright/$", views.copyrightpage),
23-
url(r"^faqs/$", views.faqindexpage),
24-
url(r"^faqs/report/$", views.faqreport, name="faqs_report"),
25-
url(r"^faqs/badges/$", views.faqbadges, name="faqs_badges"),
26-
url(r"^faqs/(?P<subject>[a-zA-Z0-9\-]{1,40})/$", views.faqarticlepage),
27-
url(r"^usage/$", views.indexpage),
28-
url(r"^widget-site/$", views.widgetsitepage),
29-
url(r"^widget-mail/$", views.widgetmailpage),
30-
url(r"^halloffame/$", views.hofchampionspage),
31-
url(r"^halloffame/web/$", views.hofwebpage),
32-
url(r"^halloffame/mail/$", views.hofmailpage),
33-
url(r"^test-connection/$", views.testconnectionpage),
34-
url(r"^connection/$", connection.index),
35-
url(r"^(connection|conn)/gettestid/$", connection.gettestid),
36-
url(rf"^(connection|conn)/finished/{regex_testid}$", connection.finished),
37-
url(rf"^(connection|conn)/addr-test/{regex_testid}/$", connection.addr_ipv6),
38-
url(rf"^(connection|conn)/{regex_testid}/results$", connection.results),
39-
url(r"^test-site/$", views.testsitepage),
40-
url(r"^(domain|site)/$", domain.index),
41-
url(rf"^(domain|site)/{regex_dname}/$", domain.siteprocess),
42-
url(rf"^(domain|site)/probes/{regex_dname}/$", domain.siteprobesstatus),
43-
url(rf"^(domain|site)/(?P<probename>(ipv6|tls|dnssec|appsecpriv))/{regex_dname}/$", domain.siteprobeview),
44-
url(rf"^(domain|site)/{regex_dname}/results$", domain.resultscurrent),
45-
url(r"^(domain|site)/(?P<dname>.*)/(?P<id>[0-9]+)/$", domain.resultsstored, name="webtest_results"),
20+
path("", views.indexpage),
21+
re_path(r"^statistics/(?P<start_date>[0-9]{8})/(?P<end_date>[0-9]{8})/$", stats.statistics),
22+
path("copyright/", views.copyrightpage),
23+
path("faqs/", views.faqindexpage),
24+
path("faqs/report/", views.faqreport, name="faqs_report"),
25+
path("faqs/badges/", views.faqbadges, name="faqs_badges"),
26+
re_path(r"^faqs/(?P<subject>[a-zA-Z0-9\-]{1,40})/$", views.faqarticlepage),
27+
path("usage/", views.indexpage),
28+
path("widget-site/", views.widgetsitepage),
29+
path("widget-mail/", views.widgetmailpage),
30+
path("halloffame/", views.hofchampionspage),
31+
path("halloffame/web/", views.hofwebpage),
32+
path("halloffame/mail/", views.hofmailpage),
33+
path("test-connection/", views.testconnectionpage),
34+
path("connection/", connection.index),
35+
re_path(r"^(connection|conn)/gettestid/$", connection.gettestid),
36+
re_path(rf"^(connection|conn)/finished/{regex_testid}$", connection.finished),
37+
re_path(rf"^(connection|conn)/addr-test/{regex_testid}/$", connection.addr_ipv6),
38+
re_path(rf"^(connection|conn)/{regex_testid}/results$", connection.results),
39+
path("test-site/", views.testsitepage),
40+
re_path(r"^(domain|site)/$", domain.index),
41+
re_path(rf"^(domain|site)/{regex_dname}/$", domain.siteprocess),
42+
re_path(rf"^(domain|site)/probes/{regex_dname}/$", domain.siteprobesstatus),
43+
re_path(rf"^(domain|site)/(?P<probename>(ipv6|tls|dnssec|appsecpriv))/{regex_dname}/$", domain.siteprobeview),
44+
re_path(rf"^(domain|site)/{regex_dname}/results$", domain.resultscurrent),
45+
re_path(r"^(domain|site)/(?P<dname>.*)/(?P<id>[0-9]+)/$", domain.resultsstored, name="webtest_results"),
4646
# Non valid domain, convert to punycode and try again
4747
# these url()s should always be the last in the ^domain/ group
48-
url(r"^(domain|site)/(?P<dname>.*)/$", domain.validate_domain),
49-
url(r"^(domain|site)/(?P<dname>.*)/results$", domain.validate_domain),
50-
url(r"^test-mail/$", views.testmailpage),
51-
url(r"^mail/$", mail.index),
52-
url(rf"^mail/{regex_mailaddr}/$", mail.mailprocess),
53-
url(rf"^mail/probes/{regex_dname}/$", mail.siteprobesstatus),
54-
url(rf"^mail/(?P<probename>(ipv6|auth|dnssec|tls))/{regex_mailaddr}/$", mail.mailprobeview),
55-
url(rf"^mail/{regex_mailaddr}/results$", mail.resultscurrent),
56-
url(r"^mail/(?P<dname>.*)/(?P<id>[0-9]+)/$", mail.resultsstored, name="mailtest_results"),
48+
re_path(r"^(domain|site)/(?P<dname>.*)/$", domain.validate_domain),
49+
re_path(r"^(domain|site)/(?P<dname>.*)/results$", domain.validate_domain),
50+
path("test-mail/", views.testmailpage),
51+
path("mail/", mail.index),
52+
re_path(rf"^mail/{regex_mailaddr}/$", mail.mailprocess),
53+
re_path(rf"^mail/probes/{regex_dname}/$", mail.siteprobesstatus),
54+
re_path(rf"^mail/(?P<probename>(ipv6|auth|dnssec|tls))/{regex_mailaddr}/$", mail.mailprobeview),
55+
re_path(rf"^mail/{regex_mailaddr}/results$", mail.resultscurrent),
56+
re_path(r"^mail/(?P<dname>.*)/(?P<id>[0-9]+)/$", mail.resultsstored, name="mailtest_results"),
5757
# Non valid mail, convert to punycode and try again
5858
# these url()s should always be the last in the ^mail/ group
59-
url(r"^mail/(?P<mailaddr>.*)/$", mail.validate_domain),
60-
url(r"^mail/(?P<mailaddr>.*)/results$", mail.validate_domain),
61-
url(rf"^clear/{regex_dname}/$", views.clear),
62-
url(r"^change_language/$", views.change_language, name="change_language"),
59+
re_path(r"^mail/(?P<mailaddr>.*)/$", mail.validate_domain),
60+
re_path(r"^mail/(?P<mailaddr>.*)/results$", mail.validate_domain),
61+
re_path(rf"^clear/{regex_dname}/$", views.clear),
62+
path("change_language/", views.change_language, name="change_language"),
6363
]
6464

6565
if settings.INTERNETNL_BRANDING:
6666
urlpatterns += [
67-
url(r"^contact/$", views.indexpage),
68-
url(r"^blogs/$", views.blogindexpage),
69-
url(r"^blogs/(?P<addr>[a-zA-Z0-9\-]{1,40})/$", views.blogarticlepage),
70-
url(r"^blogs/(?P<author>[a-zA-Z0-9\-]{1,40})/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.blogarticlepage),
71-
url(r"^news/$", views.newsindexpage),
72-
url(r"^news/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.newsarticlepage),
73-
url(r"^articles/$", views.articleindexpage),
74-
url(r"^article/$", views.articlespage),
75-
url(r"^article/(?P<article>[a-zA-Z0-9\.\-]{1,80})/$", views.articlepage),
76-
url(r"^about/$", views.aboutpage),
77-
url(r"^disclosure/$", views.disclosurepage),
78-
url(r"^privacy/$", views.privacypage),
67+
path("contact/", views.indexpage),
68+
path("blogs/", views.blogindexpage),
69+
re_path(r"^blogs/(?P<addr>[a-zA-Z0-9\-]{1,40})/$", views.blogarticlepage),
70+
re_path(r"^blogs/(?P<author>[a-zA-Z0-9\-]{1,40})/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.blogarticlepage),
71+
path("news/", views.newsindexpage),
72+
re_path(r"^news/(?P<article>[a-zA-Z0-9\-]{1,80})/$", views.newsarticlepage),
73+
path("articles/", views.articleindexpage),
74+
path("article/", views.articlespage),
75+
re_path(r"^article/(?P<article>[a-zA-Z0-9\.\-]{1,80})/$", views.articlepage),
76+
path("about/", views.aboutpage),
77+
path("disclosure/", views.disclosurepage),
78+
path("privacy/", views.privacypage),
7979
]
8080

8181
# Host-urls that are accessible by host-only, which should be approachable by developers as well during
8282
# development (although your DNS is probably not set correctly to deal with the tests.
8383
# This is not enabled by default because it returns the ip address (pii) of the requester.
8484
if settings.DEBUG:
8585
urlpatterns += [
86-
url(r"^network_ipv4/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv4),
87-
url(r"^network_ipv6/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv6),
88-
url(r"^network_resolver/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_resolver),
86+
re_path(r"^network_ipv4/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv4),
87+
re_path(r"^network_ipv6/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_ipv6),
88+
re_path(r"^network_resolver/(?P<test_id>[0-9abcdef]+)/$", views.connection.network_resolver),
8989
]
9090

9191
if hasattr(settings, "MANUAL_HOF") and settings.MANUAL_HOF:
9292
for key in settings.MANUAL_HOF:
9393
urlpatterns += [
94-
url(rf"^halloffame/(?P<manual_url>{key})/$", views.hofmanualpage),
94+
re_path(rf"^halloffame/(?P<manual_url>{key})/$", views.hofmanualpage),
9595
]
9696

9797
if hasattr(settings, "HAS_ACCESSIBILITY_PAGE") and settings.HAS_ACCESSIBILITY_PAGE:
9898
urlpatterns += [
99-
url(r"^accessibility/$", views.accessibility),
99+
path("accessibility/", views.accessibility),
100100
]
101101

102102
if settings.ENABLE_BATCH is True:
103103
urlpatterns += [
104-
url(
104+
re_path(
105105
rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests$",
106106
batch.endpoint_requests,
107107
name="batch_endpoint_requests",
108108
),
109-
url(
109+
re_path(
110110
rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}$",
111111
batch.endpoint_request,
112112
name="batch_endpoint_request",
113113
),
114-
url(
114+
re_path(
115115
rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}/results$",
116116
batch.endpoint_results,
117117
name="batch_endpoint_results",
118118
),
119-
url(
119+
re_path(
120120
rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/requests/{regex_testid}/results_technical$",
121121
batch.endpoint_results_technical,
122122
name="batch_endpoint_results_technical",
123123
),
124-
url(
124+
re_path(
125125
rf"^api/batch/v{BATCH_API_MAJOR_VERSION}/metadata/report$",
126126
batch.endpoint_metadata_report,
127127
name="batch_endpoint_metadata_report",
128128
),
129-
url(r"^api/batch/openapi.yaml$", batch.documentation, name="batch_documentation"),
129+
re_path(r"^api/batch/openapi.yaml$", batch.documentation, name="batch_documentation"),
130130
# The following should always be the last to catch now-invalid urls.
131-
url(r"^api/batch/", batch.old_url, name="batch_old"),
131+
re_path(r"^api/batch/", batch.old_url, name="batch_old"),
132132
]
133133

134134
# Serve static files for development, for production `whitenoise` app is used and the webserver is

interface/views/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.http import HttpResponse, HttpResponseRedirect
88
from django.shortcuts import redirect, render
99
from django.utils import translation
10-
from django.utils.translation import ugettext as _
10+
from django.utils.translation import gettext as _
1111

1212
from interface import redis_id, simple_cache_page
1313
from interface.views.shared import (

interface/views/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from django.core.cache import cache
1111
from django.http import HttpResponse, HttpResponseRedirect
1212
from django.shortcuts import render
13-
from django.utils.translation import ugettext as _
13+
from django.utils.translation import gettext as _
1414
from django_redis import get_redis_connection
1515

1616
import unbound

interface/views/domain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.core.cache import cache
88
from django.http import HttpResponse, HttpResponseRedirect
99
from django.shortcuts import render
10-
from django.utils.translation import ugettext as _
10+
from django.utils.translation import gettext as _
1111

1212
from checks.models import (
1313
AutoConfOption,

interface/views/mail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from django.core.cache import cache
88
from django.http import HttpResponse, HttpResponseRedirect
99
from django.shortcuts import render
10-
from django.utils.translation import ugettext as _
10+
from django.utils.translation import gettext as _
1111

1212
from checks.models import (
1313
AutoConfOption,

interface/views/shared.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from django.shortcuts import render
1919
from django.utils import timezone
2020
from django.utils.http import url_has_allowed_host_and_scheme
21-
from django.utils.translation import ugettext as _
21+
from django.utils.translation import gettext as _
2222

2323
import unbound
2424

@@ -146,7 +146,7 @@ def get_client_ip(request):
146146
147147
"""
148148
if settings.DJANGO_IS_PROXIED:
149-
ip = request.META.get("HTTP_X_FORWARDED_FOR", None)
149+
ip = request.headers.get("x-forwarded-for", None)
150150
else:
151151
ip = request.META.get("REMOTE_ADDR")
152152
return ip

internetnl/custom_middlewares.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def process_request(self, request):
2424
if translation.check_for_language(current_language):
2525
request.current_language_code = current_language
2626
else:
27-
request.current_language_code = self.get_preferred_language(request.META.get("HTTP_ACCEPT_LANGUAGE", ""))
27+
request.current_language_code = self.get_preferred_language(request.headers.get("accept-language", ""))
2828
translation.activate(request.current_language_code)
2929

3030
def get_preferred_language(self, http_accept_language):

internetnl/urls.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
33
from django.conf import settings
4-
from django.conf.urls import include, url
4+
from django.urls import include, path, re_path
55
from django.contrib import admin
66

77
urlpatterns = [
8-
url(r"^", include("interface.urls")),
8+
path("", include("interface.urls")),
99
]
1010
handler404 = "interface.views.page404"
1111

1212
if settings.DEBUG is True:
1313
urlpatterns += [
14-
url(r"^admin/", admin.site.urls),
14+
re_path(r"^admin/", admin.site.urls),
1515
]

requirements.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
# virtual environments
33
wheel
44

5-
# The current LTS of django is 3.2, see: https://www.djangoproject.com/download/#supported-versions
6-
# We'll probably wait until 4.2 LTS to be available for the next upgrade.
7-
Django<4
5+
# The current LTS of django is 4.2, see: https://www.djangoproject.com/download/#supported-versions
6+
Django<5
87

98
django-redis<5
109

requirements.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is autogenerated by pip-compile with Python 3.9
33
# by the following command:
44
#
5-
# pip-compile --resolver=backtracking requirements.in
5+
# pip-compile requirements.in
66
#
77
amqp==5.1.1
88
# via kombu
@@ -56,7 +56,7 @@ colorlog==6.7.0
5656
# via -r requirements.in
5757
cryptography==38.0.4
5858
# via -r requirements.in
59-
django==3.2.24
59+
django==4.2.10
6060
# via
6161
# -r requirements.in
6262
# django-bleach
@@ -150,8 +150,6 @@ python-dateutil==2.8.2
150150
# sectxt
151151
pythonwhois-internet-nl @ https://github.com/internetstandards/python-whois/releases/download/v1.0.0/pythonwhois-internet.nl-1.0.0.tar.gz
152152
# via -r requirements.in
153-
pytz==2023.3
154-
# via django
155153
pyyaml==6.0.1
156154
# via -r requirements.in
157155
redis==5.0.0

0 commit comments

Comments
 (0)