зеркало из https://github.com/mozilla/normandy.git
Remove short circuit decorator
This commit is contained in:
Родитель
2ea7cec780
Коммит
d12b1a1505
|
@ -4,21 +4,6 @@ from django.conf import settings
|
|||
from django.views.decorators.cache import cache_control
|
||||
|
||||
|
||||
def short_circuit_middlewares(view_func):
|
||||
"""
|
||||
Marks a view function as wanting to short circuit middlewares.
|
||||
"""
|
||||
# Based on Django's csrf_exempt
|
||||
|
||||
# We could just do view_func.short_circuit_middlewares = True, but
|
||||
# decorators are nicer if they don't have side-effects, so we return
|
||||
# a new function.
|
||||
def wrapped_view(*args, **kwargs):
|
||||
return view_func(*args, **kwargs)
|
||||
wrapped_view.short_circuit_middlewares = True
|
||||
return wraps(view_func)(wrapped_view)
|
||||
|
||||
|
||||
def api_cache_control(**kwargs):
|
||||
"""
|
||||
Adds cache headers to a view using our API cache header defaults.
|
||||
|
|
|
@ -13,8 +13,6 @@ from rest_framework.decorators import api_view, authentication_classes
|
|||
from rest_framework.response import Response
|
||||
from statsd.defaults.django import statsd
|
||||
|
||||
from normandy.base.decorators import short_circuit_middlewares
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -75,7 +73,6 @@ def version(request):
|
|||
})
|
||||
|
||||
|
||||
@short_circuit_middlewares
|
||||
@api_view(['GET'])
|
||||
def lbheartbeat(request):
|
||||
# lets the load balancer know the application is running and available
|
||||
|
@ -84,7 +81,6 @@ def lbheartbeat(request):
|
|||
return Response('', status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@short_circuit_middlewares
|
||||
@api_view(['GET'])
|
||||
@authentication_classes([])
|
||||
def heartbeat(request):
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
from normandy.base.decorators import api_cache_control, short_circuit_middlewares
|
||||
from normandy.base.decorators import api_cache_control
|
||||
|
||||
|
||||
@short_circuit_middlewares
|
||||
@api_cache_control()
|
||||
def repair(request, locale):
|
||||
return render(request, 'selfrepair/repair.html')
|
||||
|
|
Загрузка…
Ссылка в новой задаче