Changes between Version 10 and Version 12 of Ticket #33716


Ignore:
Timestamp:
May 17, 2022, 10:01:23 PM (2 years ago)
Author:
abetkin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33716

    • Property Summary async get_response can be a regular function tooasync middleware can be a regular function too
  • Ticket #33716 – Description

    v10 v12  
    3939
    4040{{{
     41def is_next_middleware_async_capable(mw):
     42    path = f'{mw.__class__.__module__}.{mw.__class__.__name__}'
     43    next_index = settings.MIDDLEWARE.index(path) + 1
     44    mw_class = import_string(settings.MIDDLEWARE[next_index])
     45    return mw_class.async_capable
     46
     47
    4148def call_mw(mw, request, _call_mw=MiddlewareMixin.__call__):
    42     if isinstance(request, ASGIRequest) and mw.async_capable:
     49    if isinstance(request, ASGIRequest) and is_next_middleware_async_capable(mw):
    4350        return mw.__acall__(request)
    4451    return _call_mw(mw, request)
Back to Top