#33716: async middleware can be a regular function too
-------------------------------+--------------------------------------
     Reporter:  abetkin        |                    Owner:  nobody
         Type:  New feature    |                   Status:  closed
    Component:  Uncategorized  |                  Version:  4.0
     Severity:  Normal         |               Resolution:  wontfix
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 As described it doesn't seem worth the disruption. You can wrap the
 (sync?) callable if needed, something like...


 {{{
 def middleware(request):
     ...

 if asyncio.iscoroutinefunction(get_response):
     async def async_middleware(request):
         return middleware(request)

     return async_middleware
 else:
     return middleware
 }}}

 A decorator for that seems feasible.

 A bigger disruption would need some further justification. Discussion for
 such would need consensus on the DevelopersMailingList.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33716#comment:16>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180d6be6bc8-a7db1d14-2103-40e5-846a-4263cabf92fa-000000%40eu-central-1.amazonses.com.

Reply via email to