mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-04 13:41:38 -04:00
Send HTTP header as well as inserting meta tag
This will let us use the decorator on endpoints that don’t return HTML.
This commit is contained in:
15
app/utils.py
15
app/utils.py
@@ -16,7 +16,16 @@ import pyexcel
|
||||
import pyexcel_xlsx
|
||||
import pytz
|
||||
from dateutil import parser
|
||||
from flask import abort, current_app, g, redirect, request, session, url_for
|
||||
from flask import (
|
||||
abort,
|
||||
current_app,
|
||||
g,
|
||||
make_response,
|
||||
redirect,
|
||||
request,
|
||||
session,
|
||||
url_for,
|
||||
)
|
||||
from flask_login import current_user, login_required
|
||||
from notifications_utils.field import Field
|
||||
from notifications_utils.formatters import (
|
||||
@@ -773,5 +782,7 @@ def hide_from_search_engines(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
g.hide_from_search_engines = True
|
||||
return f(*args, **kwargs)
|
||||
response = make_response(f(*args, **kwargs))
|
||||
response.headers['X-Robots-Tag'] = 'noindex'
|
||||
return response
|
||||
return decorated_function
|
||||
|
||||
Reference in New Issue
Block a user