Store request.is_localhost like Etiquette.
parent
6db7fe9a24
commit
65fdae97da
|
@ -45,7 +45,8 @@ site.localhost_only = False
|
|||
@site.before_request
|
||||
def before_request():
|
||||
ip = request.remote_addr
|
||||
if site.localhost_only and ip != '127.0.0.1':
|
||||
request.is_localhost = ip == '127.0.0.1'
|
||||
if site.localhost_only and not request.is_localhost:
|
||||
flask.abort(403)
|
||||
|
||||
gzip_minimum_size = 500
|
||||
|
|
Loading…
Reference in New Issue