Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix report_only to REPORT_ONLY in decorator docs #224

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,18 @@ decorators now accept a dictionary containing the CSP directives as an argument.
@csp_update({"default-src": ["another-url.com"]})
def my_view(request): ...

Additionally, each decorator now takes an optional ``report_only`` argument to specify whether the
Additionally, each decorator now takes an optional ``REPORT_ONLY`` argument to specify whether the
policy should be enforced or only report violations. For example:

.. code-block:: python

from csp.decorators import csp


@csp({"default-src": ["'self'"]}, report_only=True)
@csp({"default-src": ["'self'"]}, REPORT_ONLY=True)
def my_view(request): ...

Due to the addition of the ``report_only`` argument and for consistency, the ``csp_exempt``
Due to the addition of the ``REPORT_ONLY`` argument and for consistency, the ``csp_exempt``
decorator now requires parentheses when used with and without arguments. For example:

.. code-block:: python
Expand All @@ -157,7 +157,7 @@ decorator now requires parentheses when used with and without arguments. For exa


@csp_exempt()
@csp_exempt(report_only=True)
@csp_exempt(REPORT_ONLY=True)
def my_view(request): ...

Look for uses of the following decorators in your code: ``@csp``, ``@csp_update``, ``@csp_replace``,
Expand Down