mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #31962 -- Made SessionMiddleware raise SessionInterrupted when session destroyed while request is processing.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							fc1446073e
						
					
				
				
					commit
					2808cdc8fb
				
			| @@ -162,6 +162,18 @@ or model are classified as ``NON_FIELD_ERRORS``. This constant is used | ||||
| as a key in dictionaries that otherwise map fields to their respective | ||||
| list of errors. | ||||
|  | ||||
| ``BadRequest`` | ||||
| -------------- | ||||
|  | ||||
| .. exception:: BadRequest | ||||
|  | ||||
|     .. versionadded:: 3.2 | ||||
|  | ||||
|     The :exc:`BadRequest` exception is raised when the request cannot be | ||||
|     processed due to a client error. If a ``BadRequest`` exception reaches the | ||||
|     ASGI/WSGI handler level it results in a | ||||
|     :class:`~django.http.HttpResponseBadRequest`. | ||||
|  | ||||
| ``RequestAborted`` | ||||
| ------------------ | ||||
|  | ||||
| @@ -271,6 +283,24 @@ Http exceptions may be imported from ``django.http``. | ||||
|  | ||||
|     :exc:`UnreadablePostError` is raised when a user cancels an upload. | ||||
|  | ||||
| .. currentmodule:: django.contrib.sessions.exceptions | ||||
|  | ||||
| Sessions Exceptions | ||||
| =================== | ||||
|  | ||||
| Sessions exceptions are defined in ``django.contrib.sessions.exceptions``. | ||||
|  | ||||
| ``SessionInterrupted`` | ||||
| ---------------------- | ||||
|  | ||||
| .. exception:: SessionInterrupted | ||||
|  | ||||
|     .. versionadded:: 3.2 | ||||
|  | ||||
|     :exc:`SessionInterrupted` is raised when a session is destroyed in a | ||||
|     concurrent request. It's a subclass of | ||||
|     :exc:`~django.core.exceptions.BadRequest`. | ||||
|  | ||||
| Transaction Exceptions | ||||
| ====================== | ||||
|  | ||||
|   | ||||
| @@ -489,6 +489,11 @@ Miscellaneous | ||||
|   :py:meth:`~unittest.TestCase.setUp` method are called before | ||||
|   ``TestContextDecorator.disable()``. | ||||
|  | ||||
| * ``SessionMiddleware`` now raises a | ||||
|   :exc:`~django.contrib.sessions.exceptions.SessionInterrupted` exception | ||||
|   instead of :exc:`~django.core.exceptions.SuspiciousOperation` when a session | ||||
|   is destroyed in a concurrent request. | ||||
|  | ||||
| .. _deprecated-features-3.2: | ||||
|  | ||||
| Features deprecated in 3.2 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user