Flip guard clause.
This commit is contained in:
parent
bb846a3c97
commit
e0e12c0184
1 changed files with 3 additions and 3 deletions
|
@ -114,14 +114,13 @@ def cached_endpoint(max_age, etag_function=None, max_urls=1000):
|
||||||
if state.stored_value is NOT_CACHED:
|
if state.stored_value is NOT_CACHED:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if (time.monotonic() - state.last_run) < state.max_age:
|
if (time.monotonic() - state.last_run) > state.max_age:
|
||||||
return True
|
return False
|
||||||
|
|
||||||
if etag_function is None:
|
if etag_function is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if state.server_etag == etag_function():
|
if state.server_etag == etag_function():
|
||||||
# log.debug('Reusing server etag %s.', state.server_etag)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def update_state(state, *args, **kwargs):
|
def update_state(state, *args, **kwargs):
|
||||||
|
@ -248,6 +247,7 @@ def give_theme_cookie(function, *, cookie_name, default_theme):
|
||||||
# The original data structure for request.cookies is immutable and we
|
# The original data structure for request.cookies is immutable and we
|
||||||
# must turn it into this multidict.
|
# must turn it into this multidict.
|
||||||
request.cookies = werkzeug.datastructures.MultiDict(request.cookies)
|
request.cookies = werkzeug.datastructures.MultiDict(request.cookies)
|
||||||
|
|
||||||
# By injecting the cookie here, we allow the endpoint function to check
|
# By injecting the cookie here, we allow the endpoint function to check
|
||||||
# request.cookies even if the client didn't actually have one when they
|
# request.cookies even if the client didn't actually have one when they
|
||||||
# started the request.
|
# started the request.
|
||||||
|
|
Loading…
Reference in a new issue