You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
395 B

from functools import wraps
from django.conf import settings
from django.http import HttpResponse
def require_setting(key):
def decorator(f):
@wraps(f)
def wrapper(request, *args, **kwds):
if not getattr(settings, key):
return HttpResponse(status=404)
return f(request, *args, **kwds)
return wrapper
return decorator