Ensure that the function is synchronous for WSGI workers. Plain ``def`` functions are returned as-is. ``async def`` functions are wrapped to run and wait for the response. Override this method to change how the app runs async views. .. versionadded:: 2.0
(self, func: t.Callable[..., t.Any])
| 964 | return rv |
| 965 | |
| 966 | def ensure_sync(self, func: t.Callable[..., t.Any]) -> t.Callable[..., t.Any]: |
| 967 | """Ensure that the function is synchronous for WSGI workers. |
| 968 | Plain ``def`` functions are returned as-is. ``async def`` |
| 969 | functions are wrapped to run and wait for the response. |
| 970 | |
| 971 | Override this method to change how the app runs async views. |
| 972 | |
| 973 | .. versionadded:: 2.0 |
| 974 | """ |
| 975 | if iscoroutinefunction(func): |
| 976 | return self.async_to_sync(func) |
| 977 | |
| 978 | return func |
| 979 | |
| 980 | def async_to_sync( |
| 981 | self, func: t.Callable[..., t.Coroutine[t.Any, t.Any, t.Any]] |
no test coverage detected