summaryrefslogtreecommitdiff
path: root/django/utils/cache.py
diff options
context:
space:
mode:
authorДилян Палаузов <Dilyan.Palauzov@db.com>2018-01-03 18:52:12 -0500
committerTim Graham <timograham@gmail.com>2018-01-03 20:12:23 -0500
commitd7b2aa24f75434c2ce50100cfef3586071e0747a (patch)
tree9074eb7522888e744f948c52174f367a4281c200 /django/utils/cache.py
parentc2d0f8c084456b5073252a91eeb09ab3d7453b18 (diff)
Fixed #28982 -- Simplified code with and/or.
Diffstat (limited to 'django/utils/cache.py')
-rw-r--r--django/utils/cache.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py
index ce7faaedbc..cb49806ee9 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -142,12 +142,10 @@ def get_conditional_response(request, etag=None, last_modified=None, response=No
# Get HTTP request headers.
if_match_etags = parse_etags(request.META.get('HTTP_IF_MATCH', ''))
if_unmodified_since = request.META.get('HTTP_IF_UNMODIFIED_SINCE')
- if if_unmodified_since:
- if_unmodified_since = parse_http_date_safe(if_unmodified_since)
+ if_unmodified_since = if_unmodified_since and parse_http_date_safe(if_unmodified_since)
if_none_match_etags = parse_etags(request.META.get('HTTP_IF_NONE_MATCH', ''))
if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE')
- if if_modified_since:
- if_modified_since = parse_http_date_safe(if_modified_since)
+ if_modified_since = if_modified_since and parse_http_date_safe(if_modified_since)
# Step 1 of section 6 of RFC 7232: Test the If-Match precondition.
if if_match_etags and not _if_match_passes(etag, if_match_etags):