general: save session at the very end (#47154)
It's necessary for native django responses as rendering will not go through CompatWcsPublisher.
This commit is contained in:
parent
d27d92dc4e
commit
d6816b90ad
|
@ -228,6 +228,7 @@ class CompatWcsPublisher(WcsPublisher):
|
|||
# rendering may have altered it (for example a form would add its
|
||||
# token).
|
||||
self.session_manager.finish_successful_request()
|
||||
request.ignore_session = True # no further changes
|
||||
|
||||
for name, value in response.generate_headers():
|
||||
if name in ('Connection', 'Content-Length'):
|
||||
|
|
|
@ -91,6 +91,13 @@ class PublisherInitialisationMiddleware(MiddlewareMixin):
|
|||
def process_response(self, request, response):
|
||||
pub = get_publisher()
|
||||
if pub:
|
||||
request = pub.get_request()
|
||||
if request and not request.ignore_session:
|
||||
# it is necessary to save the session one last time as the actual
|
||||
# rendering may have altered it (for example a form would add its
|
||||
# token).
|
||||
pub.session_manager.finish_successful_request()
|
||||
|
||||
pub.cleanup()
|
||||
return response
|
||||
|
||||
|
|
Loading…
Reference in New Issue