Skip to content

Commit f6da0bf

Browse files
committed
Prepare for 4.0b2 release
1 parent f0b40f6 commit f6da0bf

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,22 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.5.0
17+
rev: v0.6.4
1818
hooks:
1919
# Run the linter
2020
- id: ruff
2121
args: [--fix, --exit-non-zero-on-fix]
2222
# Run the formatter
2323
- id: ruff-format
2424
- repo: https://github.com/tox-dev/pyproject-fmt
25-
rev: 2.1.3
25+
rev: 2.2.3
2626
hooks:
2727
- id: pyproject-fmt
28+
- repo: https://github.com/adamchainz/blacken-docs
29+
rev: 1.18.0
30+
hooks:
31+
- id: blacken-docs
32+
additional_dependencies:
33+
- black==24.4.2
34+
files: 'docs/.*\.rst$'
35+
args: ["--rst-literal-block"]

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,17 @@ CHANGES
33

44
Unreleased
55
==========
6+
7+
4.0b2
8+
=====
69
- Add type hints. ([#228](https://github.com/mozilla/django-csp/pull/228))
710
- Expand ruff configuration and move into pyproject.toml [[#234](https://github.com/mozilla/django-csp/pull/234)]
11+
- Documentation fixes by jamesbeith and jcari-dev
12+
- Simplify middleware logic ([#226](https://github.com/mozilla/django-csp/pull/226))
13+
- Report percentage of 100% should always send CSP report ([#236](https://github.com/mozilla/django-csp/pull/236))
14+
- Changes to make `CSPMiddleware` easier to subclass ([#237](https://github.com/mozilla/django-csp/pull/237))
15+
- Change `REPORT_PERCENTAGE` to allow floats (e.g. for values < 1%) ([#242](https://github.com/mozilla/django-csp/pull/242))
16+
- Add Django 5.1 support ([#243](https://github.com/mozilla/django-csp/pull/243))
817

918
4.0b1
1019
=====

docs/decorators.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ settings. If there is no setting, the value passed to the decorator will be used
5353
.. note::
5454

5555
To quote the CSP spec: "There's no inheritance; ... the default list is not used for that
56-
resource type" if it is set. E.g., the following will not allow images from 'self'::
56+
resource type" if it is set. E.g., the following will not allow images from 'self':
5757

5858
default-src 'self'; img-src imgsrv.com
5959

docs/migration-guide.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ An existing custom middleware, such as this:
213213
214214
from csp.middleware import CSPMiddleware, PolicyParts
215215
216+
216217
class ACustomMiddleware(CSPMiddleware):
217218
218219
def build_policy(self, request: HttpRequest, response: HttpResponseBase) -> str:
@@ -231,7 +232,7 @@ An existing custom middleware, such as this:
231232
replace = getattr(response, "_csp_replace_ro", {})
232233
nonce = getattr(request, "_csp_nonce", None)
233234
234-
# ... do custom CSP report only policy logic ...
235+
# ... do custom CSP report-only policy logic ...
235236
236237
return build_policy(config=config, update=update, replace=replace, nonce=nonce)
237238
@@ -246,13 +247,18 @@ can be replaced with this:
246247
247248
class ACustomMiddleware(CSPMiddleware):
248249
249-
def get_policy_parts(self, request: HttpRequest, response: HttpResponseBase, report_only: bool = False) -> PolicyParts:
250+
def get_policy_parts(
251+
self,
252+
request: HttpRequest,
253+
response: HttpResponseBase,
254+
report_only: bool = False,
255+
) -> PolicyParts:
250256
policy_parts = super().get_policy_parts(request, response, report_only)
251257
252258
if report_only:
253-
# ... do custom CSP report only policy logic ...
259+
... # do custom CSP report-only policy logic
254260
else:
255-
# ... do custom CSP policy logic ...
261+
... # do custom CSP policy logic
256262
257263
return policy_parts
258264

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ requires = [
66

77
[project]
88
name = "django-csp"
9-
version = "4.0b1"
9+
version = "4.0b2"
1010
description = "Django Content Security Policy support."
1111
readme = "README.rst"
1212
license = { text = "BSD" }

0 commit comments

Comments
 (0)