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

  1. from functools import wraps
  2. from django.conf import settings
  3. from django.http import HttpResponse
  4. def require_setting(key):
  5. def decorator(f):
  6. @wraps(f)
  7. def wrapper(request, *args, **kwds):
  8. if not getattr(settings, key):
  9. return HttpResponse(status=404)
  10. return f(request, *args, **kwds)
  11. return wrapper
  12. return decorator