@@ -23,7 +23,8 @@ def get_user(scope):
23
23
Return the user model instance associated with the given scope.
24
24
If no user is retrieved, return an instance of `AnonymousUser`.
25
25
"""
26
- # postpone model import to avoid ImproperlyConfigured error before Django setup is complete.
26
+ # postpone model import to avoid ImproperlyConfigured error before Django
27
+ # setup is complete.
27
28
from django .contrib .auth .models import AnonymousUser
28
29
29
30
if "session" not in scope :
@@ -59,7 +60,8 @@ def login(scope, user, backend=None):
59
60
"""
60
61
Persist a user id and a backend in the request.
61
62
This way a user doesn't have to re-authenticate on every request.
62
- Note that data set during the anonymous session is retained when the user logs in.
63
+ Note that data set during the anonymous session is retained when the user
64
+ logs in.
63
65
"""
64
66
if "session" not in scope :
65
67
raise ValueError (
@@ -112,9 +114,11 @@ def login(scope, user, backend=None):
112
114
@database_sync_to_async
113
115
def logout (scope ):
114
116
"""
115
- Remove the authenticated user's ID from the request and flush their session data.
117
+ Remove the authenticated user's ID from the request and flush their session
118
+ data.
116
119
"""
117
- # postpone model import to avoid ImproperlyConfigured error before Django setup is complete.
120
+ # postpone model import to avoid ImproperlyConfigured error before Django
121
+ # setup is complete.
118
122
from django .contrib .auth .models import AnonymousUser
119
123
120
124
if "session" not in scope :
0 commit comments