django-downloadview/django_downloadview/apache/decorators.py

17 lines
530 B
Python
Raw Normal View History

"""Decorators to apply Apache X-Sendfile on a specific view."""
2024-08-05 08:51:17 +00:00
from django_downloadview.apache.middlewares import XSendfileMiddleware
2020-01-07 14:18:54 +00:00
from django_downloadview.decorators import DownloadDecorator
def x_sendfile(view_func, *args, **kwargs):
"""Apply
:class:`~django_downloadview.apache.middlewares.XSendfileMiddleware` to
``view_func``.
Proxies (``*args``, ``**kwargs``) to middleware constructor.
"""
decorator = DownloadDecorator(XSendfileMiddleware)
return decorator(view_func, *args, **kwargs)