mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
Add Clacks Overhead header on each response. Closes #84
Signed-off-by: Yohann D'ANELLO <yohann.danello@gmail.com>
This commit is contained in:
parent
893534955d
commit
d9c97628e2
@ -142,3 +142,17 @@ class TurbolinksMiddleware(object):
|
|||||||
location = request.session.pop('_turbolinks_redirect_to')
|
location = request.session.pop('_turbolinks_redirect_to')
|
||||||
response['Turbolinks-Location'] = location
|
response['Turbolinks-Location'] = location
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
class ClacksMiddleware(object):
|
||||||
|
"""
|
||||||
|
Add Clacks Overhead header on each response.
|
||||||
|
See https://www.gnuterrypratchett.com/
|
||||||
|
"""
|
||||||
|
def __init__(self, get_response):
|
||||||
|
self.get_response = get_response
|
||||||
|
|
||||||
|
def __call__(self, request):
|
||||||
|
response = self.get_response(request)
|
||||||
|
response['X-Clacks-Overhead'] = 'GNU Terry Pratchett'
|
||||||
|
return response
|
||||||
|
@ -82,6 +82,7 @@ MIDDLEWARE = [
|
|||||||
'note_kfet.middlewares.SessionMiddleware',
|
'note_kfet.middlewares.SessionMiddleware',
|
||||||
'note_kfet.middlewares.LoginByIPMiddleware',
|
'note_kfet.middlewares.LoginByIPMiddleware',
|
||||||
'note_kfet.middlewares.TurbolinksMiddleware',
|
'note_kfet.middlewares.TurbolinksMiddleware',
|
||||||
|
'note_kfet.middlewares.ClacksMiddleware',
|
||||||
]
|
]
|
||||||
|
|
||||||
ROOT_URLCONF = 'note_kfet.urls'
|
ROOT_URLCONF = 'note_kfet.urls'
|
||||||
|
Loading…
Reference in New Issue
Block a user