summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/contributing/writing-code/unit-tests.txt2
-rw-r--r--docs/releases/4.2.txt3
-rw-r--r--docs/topics/async.txt6
-rw-r--r--docs/topics/http/middleware.txt6
4 files changed, 10 insertions, 7 deletions
diff --git a/docs/internals/contributing/writing-code/unit-tests.txt b/docs/internals/contributing/writing-code/unit-tests.txt
index 939abb5631..e9102110eb 100644
--- a/docs/internals/contributing/writing-code/unit-tests.txt
+++ b/docs/internals/contributing/writing-code/unit-tests.txt
@@ -278,7 +278,7 @@ dependencies:
* aiosmtpd_
* argon2-cffi_ 19.1.0+
-* asgiref_ 3.5.2+ (required)
+* asgiref_ 3.6.0+ (required)
* bcrypt_
* colorama_
* docutils_
diff --git a/docs/releases/4.2.txt b/docs/releases/4.2.txt
index 7e93df0702..7979e2359b 100644
--- a/docs/releases/4.2.txt
+++ b/docs/releases/4.2.txt
@@ -438,6 +438,9 @@ Miscellaneous
``DatabaseIntrospection.get_table_description()`` rather than
``internal_size`` for ``CharField``.
+* The minimum supported version of ``asgiref`` is increased from 3.5.2 to
+ 3.6.0.
+
.. _deprecated-features-4.2:
Features deprecated in 4.2
diff --git a/docs/topics/async.txt b/docs/topics/async.txt
index a3cc77aeba..39ca864655 100644
--- a/docs/topics/async.txt
+++ b/docs/topics/async.txt
@@ -28,10 +28,10 @@ class-based view, this means declaring the HTTP method handlers, such as
.. note::
- Django uses ``asyncio.iscoroutinefunction`` to test if your view is
+ Django uses ``asgiref.sync.iscoroutinefunction`` to test if your view is
asynchronous or not. If you implement your own method of returning a
- coroutine, ensure you set the ``_is_coroutine`` attribute of the view
- to ``asyncio.coroutines._is_coroutine`` so this function returns ``True``.
+ coroutine, ensure you use ``asgiref.sync.markcoroutinefunction`` so this
+ function returns ``True``.
Under a WSGI server, async views will run in their own, one-off event loop.
This means you can use async features, like concurrent async HTTP requests,
diff --git a/docs/topics/http/middleware.txt b/docs/topics/http/middleware.txt
index 29f379889f..e1a3e95ebc 100644
--- a/docs/topics/http/middleware.txt
+++ b/docs/topics/http/middleware.txt
@@ -312,7 +312,7 @@ If your middleware has both ``sync_capable = True`` and
``async_capable = True``, then Django will pass it the request without
converting it. In this case, you can work out if your middleware will receive
async requests by checking if the ``get_response`` object you are passed is a
-coroutine function, using ``asyncio.iscoroutinefunction``.
+coroutine function, using ``asgiref.sync.iscoroutinefunction``.
The ``django.utils.decorators`` module contains
:func:`~django.utils.decorators.sync_only_middleware`,
@@ -331,13 +331,13 @@ at an additional performance penalty.
Here's an example of how to create a middleware function that supports both::
- import asyncio
+ from asgiref.sync import iscoroutinefunction
from django.utils.decorators import sync_and_async_middleware
@sync_and_async_middleware
def simple_middleware(get_response):
# One-time configuration and initialization goes here.
- if asyncio.iscoroutinefunction(get_response):
+ if iscoroutinefunction(get_response):
async def middleware(request):
# Do something here!
response = await get_response(request)