Changes between Initial Version and Version 1 of Ticket #34174


Ignore:
Timestamp:
Nov 21, 2022, 8:24:30 AM (2 years ago)
Author:
Gabriel Rado
Comment:

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]:
     1following 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.
    23
    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:
     4I'm using this middleware to parse errors from sync and async views:
    75
    86
     
    3230}}}
    3331
    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]
     32and 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]
    3533
    3634i 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?
Back to Top