(self, request, response, api_version=None, **kwargs)
| 876 | response.data = content |
| 877 | |
| 878 | def __call__(self, request, response, api_version=None, **kwargs): |
| 879 | context = self.api.context_factory( |
| 880 | response=response, |
| 881 | request=request, |
| 882 | api=self.api, |
| 883 | api_version=api_version, |
| 884 | interface=self, |
| 885 | ) |
| 886 | """Call the wrapped function over HTTP pulling information as needed""" |
| 887 | if isinstance(api_version, str) and api_version.isdigit(): |
| 888 | api_version = int(api_version) |
| 889 | else: |
| 890 | api_version = None |
| 891 | if not self.catch_exceptions: |
| 892 | exception_types = () |
| 893 | else: |
| 894 | exception_types = self.api.http.exception_handlers(api_version) |
| 895 | exception_types = tuple(exception_types.keys()) if exception_types else () |
| 896 | input_parameters = {} |
| 897 | try: |
| 898 | self.set_response_defaults(response, request) |
| 899 | lacks_requirement = self.check_requirements(request, response, context) |
| 900 | if lacks_requirement: |
| 901 | response.data = self.outputs( |
| 902 | lacks_requirement, |
| 903 | **self._arguments(self._params_for_outputs, request, response) |
| 904 | ) |
| 905 | self.api.delete_context(context, lacks_requirement=lacks_requirement) |
| 906 | return |
| 907 | |
| 908 | input_parameters = self.gather_parameters( |
| 909 | request, response, context, api_version, **kwargs |
| 910 | ) |
| 911 | errors = self.validate(input_parameters, context) |
| 912 | if errors: |
| 913 | self.api.delete_context(context, errors=errors) |
| 914 | return self.render_errors(errors, request, response) |
| 915 | |
| 916 | self.render_content( |
| 917 | self.call_function(input_parameters), context, request, response, **kwargs |
| 918 | ) |
| 919 | except falcon.HTTPNotFound as exception: |
| 920 | self.cleanup_parameters(input_parameters, exception=exception) |
| 921 | self.api.delete_context(context, exception=exception) |
| 922 | return self.api.http.not_found(request, response, **kwargs) |
| 923 | except exception_types as exception: |
| 924 | self.cleanup_parameters(input_parameters, exception=exception) |
| 925 | self.api.delete_context(context, exception=exception) |
| 926 | handler = None |
| 927 | exception_type = type(exception) |
| 928 | if exception_type in exception_types: |
| 929 | handler = self.api.http.exception_handlers(api_version)[exception_type][0] |
| 930 | else: |
| 931 | for match_exception_type, exception_handlers in tuple( |
| 932 | self.api.http.exception_handlers(api_version).items() |
| 933 | )[::-1]: |
| 934 | if isinstance(exception, match_exception_type): |
| 935 | for potential_handler in exception_handlers: |
nothing calls this directly
no test coverage detected