#31229: Add setting to allow flexible session saving based on response codes -----------------------------------------+------------------------ Reporter: Vincent Wang | Owner: nobody Type: Uncategorized | Status: new Component: Uncategorized | Version: 3.0 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -----------------------------------------+------------------------ Inside django.contrib.sessions.middleware.SessionMiddleware.process_response (https://github.com/django/django/blob/master/django/contrib/sessions/middleware.py), we have a line where we don't save the session of the request if the response status code is 500. The comment in the code refers to this issue: https://code.djangoproject.com/ticket/3881 where it's concluded that a 500 code is most likely to indicate that it's an incomplete request and the response shouldn't save anything else.
I would find it useful to be able to prevent saving of the session when the response status code is anything in the 5xx status code range. This would be possible if we implemented some setting that defaulted to include the status code 500, but allowed users to override it with a list of status codes where the session would not save. -- Ticket URL: <https://code.djangoproject.com/ticket/31229> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/051.30b77ab1588aa56041cfbdb7d2905738%40djangoproject.com.