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
|
# rendering may have altered it (for example a form would add its
|
||||||
# token).
|
# token).
|
||||||
self.session_manager.finish_successful_request()
|
self.session_manager.finish_successful_request()
|
||||||
|
request.ignore_session = True # no further changes
|
||||||
|
|
||||||
for name, value in response.generate_headers():
|
for name, value in response.generate_headers():
|
||||||
if name in ('Connection', 'Content-Length'):
|
if name in ('Connection', 'Content-Length'):
|
||||||
|
|
|
@ -91,6 +91,13 @@ class PublisherInitialisationMiddleware(MiddlewareMixin):
|
||||||
def process_response(self, request, response):
|
def process_response(self, request, response):
|
||||||
pub = get_publisher()
|
pub = get_publisher()
|
||||||
if pub:
|
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()
|
pub.cleanup()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue