MCPcopy
hub / github.com/django/django / process_response

Method process_response

django/contrib/messages/middleware.py:14–26  ·  view source on GitHub ↗

Update the storage backend (i.e., save the messages). Raise ValueError if not all messages could be stored and DEBUG is True.

(self, request, response)

Source from the content-addressed store, hash-verified

12 request._messages = default_storage(request)
13
14 def process_response(self, request, response):
15 """
16 Update the storage backend (i.e., save the messages).
17
18 Raise ValueError if not all messages could be stored and DEBUG is True.
19 """
20 # A higher middleware layer may return a request which does not contain
21 # messages storage, so make no assumption that it will be there.
22 if hasattr(request, "_messages"):
23 unstored_messages = request._messages.update(response)
24 if unstored_messages and settings.DEBUG:
25 raise ValueError("Not all temporary messages could be stored.")
26 return response

Callers

nothing calls this directly

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected