##// END OF EJS Templates
file-store: don't response with cookies on file-store download.
marcink -
r4236:a948e8d8 stable
parent child Browse files
Show More
@@ -93,6 +93,9 b' class FileStoreView(BaseAppView):'
93
93
94 file_path = self.storage.store_path(file_uid)
94 file_path = self.storage.store_path(file_uid)
95 return FileResponse(file_path)
95 return FileResponse(file_path)
96 # For file store we don't submit any session data, this logic tells the
97 # Session lib to skip it
98 setattr(self.request, '_file_response', True)
96
99
97 @LoginRequired()
100 @LoginRequired()
98 @NotAnonymous()
101 @NotAnonymous()
@@ -32,10 +32,14 b' def BeakerSessionFactoryConfig(**options'
32
32
33 def session_callback(request, response):
33 def session_callback(request, response):
34 exception = getattr(request, 'exception', None)
34 exception = getattr(request, 'exception', None)
35 if (exception is None or self._cookie_on_exception) and self.accessed():
35 file_response = getattr(request, '_file_response', None)
36
37 if file_response is None \
38 and (exception is None or self._cookie_on_exception) \
39 and self.accessed():
36 self.persist()
40 self.persist()
37 headers = self.__dict__['_headers']
41 headers = self.__dict__['_headers']
38 if headers['set_cookie'] and headers['cookie_out']:
42 if headers.get('set_cookie') and headers.get('cookie_out'):
39 response.headerlist.append(('Set-Cookie', headers['cookie_out']))
43 response.headerlist.append(('Set-Cookie', headers['cookie_out']))
40 request.add_response_callback(session_callback)
44 request.add_response_callback(session_callback)
41
45
General Comments 0
You need to be logged in to leave comments. Login now