Changes between Initial Version and Version 1 of Ticket #34174
- Timestamp:
- Nov 21, 2022, 8:24:30 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34174 – Description
initial v1 1 following this bold part of the docs[https://docs.djangoproject.com/en/4.1/topics/http/middleware/#asynchronous-support]: 1 following this bold part from [https://docs.djangoproject.com/en/4.1/topics/http/middleware/#asynchronous-support]: 2 > process_view, process_template_response and process_exception methods, if they are provided, **should also be adapted to match the sync/async mode**. However, Django will individually adapt them as required if you do not, at an additional performance penalty. 2 3 3 4 process_view, process_template_response and process_exception methods, if they are provided, **should also be adapted to match the sync/async mode**. However, Django will individually adapt them as required if you do not, at an additional performance penalty. 5 6 I' using this middleware to parse errors from sync and async views: 4 I'm using this middleware to parse errors from sync and async views: 7 5 8 6 … … 32 30 }}} 33 31 34 and I'm getting "ValueError: The view my_view.view_func didn't return an HttpResponse object. It returned an unawaited coroutine instead. You may need to add an 'await' into your view." from here[https://github.com/django/django/blob/main/django/core/handlers/base.py#L257]32 and I'm getting "ValueError: The view my_view.view_func didn't return an HttpResponse object. It returned an unawaited coroutine instead. You may need to add an 'await' into your view." from [https://github.com/django/django/blob/main/django/core/handlers/base.py#L257] 35 33 36 34 i thought that with an async middleware + async view, all my hooks (process_view, process_template_response and process_exception) should be also async, but it appears that is mandatory to use sync process_exception with async capable middlewares. if this is intended, could the official docs be changed to expose this mandatory behavior?