Skip to content

Commit 1bee2bb

Browse files
UsamaSadiqregisb
authored andcommitted
feat: add django 5.2 support
1 parent 7dd1f23 commit 1bee2bb

File tree

9 files changed

+17
-15
lines changed

9 files changed

+17
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
matrix:
1818
os: [ubuntu-latest]
1919
python-version: ['3.12']
20-
toxenv: [docs, quality, django42]
20+
toxenv: [docs, quality, django42, django52]
2121

2222
steps:
2323
- uses: actions/checkout@v4
@@ -38,7 +38,7 @@ jobs:
3838
run: tox
3939

4040
- name: Run coverage
41-
if: matrix.python-version == '3.12' && matrix.toxenv == 'django42'
41+
if: matrix.python-version == '3.12' && matrix.toxenv == 'django52'
4242
uses: codecov/codecov-action@v5
4343
with:
4444
token: ${{ secrets.CODECOV_TOKEN }}

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Change Log
1414
Unreleased
1515
----------
1616

17+
7.3.0 - 2025-04-09
18+
------------------
19+
Added
20+
~~~~~
21+
* Added support for Django 5.2
1722

1823
7.2.0 - 2025-02-26
1924
------------------

edx_django_utils/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
"""
44

55
__version__ = "7.2.0"
6-
7-
default_app_config = (
8-
"edx_django_utils.apps.EdxDjangoUtilsConfig"
9-
)
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
"""
22
Tests for Data Generation
33
"""
4-
5-
default_app_config = 'edx_django_utils.data_generation.tests.apps.DataGenerationTestsConfig'

edx_django_utils/monitoring/internal/middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ def get_log_message_and_monitor_cookies(self, request):
382382
id is available for authenticated calls.
383383
384384
"""
385-
raw_header_cookie = request.META.get('HTTP_COOKIE', '')
385+
raw_header_cookie = request.headers.get('cookie', '')
386386
cookie_header_size = len(raw_header_cookie.encode('utf-8'))
387387
# .. custom_attribute_name: cookies.header.size
388388
# .. custom_attribute_description: The total size in bytes of the cookie header.

edx_django_utils/monitoring/tests/code_owner/test_middleware.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import ddt
88
from django.test import RequestFactory, override_settings
9-
from django.urls import re_path
9+
from django.urls import path
1010
from django.views.generic import View
1111

1212
from edx_django_utils.monitoring import CodeOwnerMonitoringMiddleware
@@ -20,8 +20,8 @@ class MockMiddlewareViewTest(View):
2020

2121

2222
urlpatterns = [
23-
re_path(r'^middleware-test/$', MockMiddlewareViewTest.as_view()),
24-
re_path(r'^test/$', MockViewTest.as_view()),
23+
path('middleware-test/', MockMiddlewareViewTest.as_view()),
24+
path('test/', MockViewTest.as_view()),
2525
]
2626

2727
SET_CUSTOM_ATTRIBUTE_MOCK = MagicMock()

edx_django_utils/monitoring/tests/test_middleware.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ class TestDeploymentMonitoringMiddleware(TestCase):
5353
"""
5454
Test the DeploymentMonitoringMiddleware functionalities
5555
"""
56-
version_pattern = r'\d+(\.\d+){2}'
56+
# To handle both major.minor and major.minor.patch versions
57+
version_pattern = r'^\d+\.\d+(\.\d+)?'
5758

5859
def setUp(self):
5960
super().setUp()
@@ -138,7 +139,7 @@ def test_cookie_header_corrupt_monitoring(
138139
middleware(request)
139140

140141
mock_set_custom_attribute.assert_has_calls([
141-
call('cookies.header.size', len(request.META['HTTP_COOKIE'])),
142+
call('cookies.header.size', len(request.headers['cookie'])),
142143
call('cookies.header.corrupt_count', expected_corrupt_count),
143144
call('cookies.header.corrupt_key_count', expected_corrupt_key_count),
144145
])

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ def is_requirement(line):
157157
'Development Status :: 3 - Alpha',
158158
'Framework :: Django',
159159
'Framework :: Django :: 4.2',
160+
'Framework :: Django :: 5.2',
160161
'Intended Audience :: Developers',
161162
'License :: OSI Approved :: Apache Software License',
162163
'Natural Language :: English',

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{312}-django{42}, docs, quality
2+
envlist = py{312}-django{42, 52}, docs, quality
33

44
[doc8]
55
ignore = D000, D001
@@ -39,6 +39,7 @@ norecursedirs = .* docs requirements
3939
deps =
4040
setuptools
4141
django42: Django>=4.2,<4.3
42+
django52: Django>=5.2,<5.3
4243
-r{toxinidir}/requirements/test.txt
4344
commands =
4445
python -Wd -m pytest {posargs}

0 commit comments

Comments
 (0)