def __wrap_before_filter(self, wrapped_func, *args, **kwargs):
        if getattr(self, '_before_filter_runonce', False) == False and getattr(self._action_func,'disable_filters', False) == False:
            self._before_filter_runonce = True

            if self._before_filter.func_code.co_argcount >= 2:
                filter_response = self._before_filter(self._request)
            else:
                filter_response = self._before_filter()
            
            if type(filter_response) is dict:
                self._template_context.update(filter_response)
            elif filter_response is not None:
                return filter_response
        
        if hasattr(self, 'do_not_pass_request'):
            action_response = wrapped_func(*args, **kwargs)
        else:
            action_response = wrapped_func(self._request, *args, **kwargs)
        if type(action_response) is dict:
            self._template_context.update(action_response)
            return self._template_context

        return action_response
dataset/ETHPy150Open zeraien/django-url-framework/django_url_framework/controller.py/ActionController.__wrap_before_filter/original