File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -52,17 +52,15 @@ async def synchronize_session_watchdog():
5252 set_synchronize_requested (False )
5353
5454 async def synchronize_session ():
55- """Entrypoint where the server will command the client to switch HTTP sessions
56- to match the websocket session. This function is stored in the websocket scope so that
57- ReactPy-Django's hooks can access it."""
55+ """Event that can command the client to switch HTTP sessions (to match the websocket sessions)."""
5856 session : SessionBase | None = scope .get ("session" )
5957 if not session or not session .session_key :
6058 return
6159
6260 # Delete any sessions currently associated with the previous UUID.
6361 # This exists to fix scenarios where...
64- # 1) A component tree performs multiple login commands for different users .
65- # 2) A login is requested , but the server failed to respond to the HTTP request.
62+ # 1) Login is called multiple times before the first one is completed .
63+ # 2) Login was called , but the server failed to respond to the HTTP request.
6664 if uuid .current :
6765 with contextlib .suppress (SynchronizeSession .DoesNotExist ):
6866 obj = await SynchronizeSession .objects .aget (uuid = uuid .current )
Original file line number Diff line number Diff line change @@ -418,15 +418,15 @@ def use_root_id() -> str:
418418
419419
420420def use_auth ():
421- """Provides the ability to login/logout a user using Django's standard authentication framework."""
421+ """Provides the ability to login/logout a user using Django's authentication framework."""
422422 from reactpy_django import config
423423
424424 scope = use_scope ()
425425
426426 async def login (user : AbstractUser ):
427427 await channels_auth .login (scope , user , backend = config .REACTPY_AUTH_BACKEND )
428- session_save_func = getattr (scope ["session" ], "asave" , scope ["session" ].save )
429- await ensure_async (session_save_func )()
428+ session_save_method = getattr (scope ["session" ], "asave" , scope ["session" ].save )
429+ await ensure_async (session_save_method )()
430430 await scope ["reactpy" ]["synchronize_session" ]()
431431
432432 async def logout (rerender : bool = True ):
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class ComponentSession(models.Model):
2121
2222
2323class SynchronizeSession (models .Model ):
24- """A model for stores any relevant data needed to force Django's HTTP session to
24+ """A model that contains any relevant data needed to force Django's HTTP session to
2525 match the websocket session.
2626
2727 This data is tied to an arbitrary UUID for security (obfuscation) purposes.
You can’t perform that action at this time.
0 commit comments