kolibri/core/content/decorators.py
def add_security_headers(some_func):
    """
    Decorator for adding security headers to zipcontent endpoints
    """

    def wrapper_func(request, *args, **kwargs):

        response = some_func(request, *args, **kwargs)

        try:
            request = args[0]
            request = kwargs.get("request", request)
        except IndexError:
            request = kwargs.get("request", None)

        if request and response:
            _add_access_control_headers(request, response)
            _add_content_security_policy_header(request, response)

        return response

    return wrapper_func

    Decorator for adding security headers to zipcontent endpoints
    
Decorator for adding security headers to zipcontent endpoints
Decorator for adding security headers to zipcontent endpoints
def add_security_headers(some_func):
    def wrapper_func(request, *args, **kwargs):
        response = some_func(request, *args, **kwargs)
        try:
            request = args[0]
            request = kwargs.get("request", request)
        except IndexError:
            request = kwargs.get("request", None)
        if request and response:
            _add_access_control_headers(request, response)
            _add_content_security_policy_header(request, response)
        return response
    return wrapper_func
def add_security_headers ( some_func ) : def wrapper_func ( request , * args , ** kwargs ) : response = some_func ( request , * args , ** kwargs ) try : request = args [ 0 ] request = kwargs . get ( "request" , request ) except IndexError : request = kwargs . get ( "request" , None ) if request and response : _add_access_control_headers ( request , response ) _add_content_security_policy_header ( request , response ) return response return wrapper_func
Decorator for adding security headers to zipcontent endpoints
Decorator for adding security headers to zipcontent endpoints
"""
    Decorator for adding security headers to zipcontent endpoints
    """
some_func