From d7b2aa24f75434c2ce50100cfef3586071e0747a Mon Sep 17 00:00:00 2001 From: Дилян Палаузов Date: Wed, 3 Jan 2018 18:52:12 -0500 Subject: Fixed #28982 -- Simplified code with and/or. --- django/utils/cache.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'django/utils/cache.py') 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): -- cgit v1.3