Skip to content

Commit

Permalink
Merge pull request #2398 from pallets/cache-control-none
Browse files Browse the repository at this point in the history
set cache_control with none type
  • Loading branch information
davidism authored Apr 25, 2022
2 parents 988f009 + dfe2684 commit 19323ef
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Unreleased
for 1xx, 204, 304, and HEAD responses. :issue:`2375`
- Response HTML for exceptions and redirects starts with
``<!doctype html>`` and ``<html lang=en>``. :issue:`2390`
- Fix ability to set some ``cache_control`` attributes to ``False``.
:issue:`2379`


Version 2.1.1
Expand Down
5 changes: 4 additions & 1 deletion src/werkzeug/datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,10 @@ def _set_cache_value(self, key, value, type):
elif value is True:
self[key] = None
else:
self[key] = type(value)
if type is not None:
self[key] = type(value)
else:
self[key] = value

def _del_cache_value(self, key):
"""Used internally by the accessor properties."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_datastructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,8 @@ def test_set_none(self):
assert cc.no_cache is None
cc.no_cache = None
assert cc.no_cache is None
cc.no_cache = False
assert cc.no_cache is False


class TestContentSecurityPolicy:
Expand Down

0 comments on commit 19323ef

Please sign in to comment.