diff options
author | Tim Graham <timograham@gmail.com> | 2016-03-28 18:33:29 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-04-08 09:51:06 -0400 |
commit | df8d8d4292684d6ffa7474f1e201aed486f02b53 (patch) | |
tree | c661bf9b33de5288afe4f63347a2a9c768ef98eb /django/utils/cache.py | |
parent | 2956e2f5e3f63d279f5dae2a995265364d3e6db1 (diff) | |
download | django-df8d8d4292684d6ffa7474f1e201aed486f02b53.tar.gz |
Fixed E128 flake8 warnings in django/.
Diffstat (limited to 'django/utils/cache.py')
-rw-r--r-- | django/utils/cache.py | 20 |
1 files changed, 9 insertions, 11 deletions
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 |