From df8d8d4292684d6ffa7474f1e201aed486f02b53 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 28 Mar 2016 18:33:29 -0400 Subject: Fixed E128 flake8 warnings in django/. --- django/utils/cache.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'django/utils/cache.py') diff --git a/django/utils/cache.py b/django/utils/cache.py index eb3aa631ec..be1626a263 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -94,8 +94,7 @@ def get_max_age(response): """ if not response.has_header('Cache-Control'): return - cc = dict(_to_tuple(el) for el in - cc_delim_re.split(response['Cache-Control'])) + cc = dict(_to_tuple(el) for el in cc_delim_re.split(response['Cache-Control'])) if 'max-age' in cc: try: return int(cc['max-age']) @@ -110,7 +109,8 @@ def set_response_etag(response): def _precondition_failed(request): - logger.warning('Precondition Failed: %s', request.path, + logger.warning( + 'Precondition Failed: %s', request.path, extra={ 'status_code': 412, 'request': request, @@ -173,19 +173,17 @@ def get_conditional_response(request, etag=None, last_modified=None, response=No (if_match and if_none_match)): # We only get here if no undefined combinations of headers are # specified. - if ((if_none_match and (etag in etags or - '*' in etags and etag)) and + if ((if_none_match and (etag in etags or '*' in etags and etag)) and (not if_modified_since or - (last_modified and if_modified_since and - last_modified <= if_modified_since))): + (last_modified and if_modified_since and last_modified <= if_modified_since))): if request.method in ('GET', 'HEAD'): return _not_modified(request, response) else: return _precondition_failed(request) - elif (if_match and ((not etag and '*' in etags) or - (etag and etag not in etags) or - (last_modified and if_unmodified_since and - last_modified > if_unmodified_since))): + elif (if_match and ( + (not etag and '*' in etags) or (etag and etag not in etags) or + (last_modified and if_unmodified_since and last_modified > if_unmodified_since) + )): return _precondition_failed(request) elif (not if_none_match and request.method in ('GET', 'HEAD') and last_modified and if_modified_since and -- cgit v1.3