[LNT] r298979 - Make flask sessions permanent
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 28 22:49:50 PDT 2017
Author: cmatthews
Date: Wed Mar 29 00:49:50 2017
New Revision: 298979
URL: http://llvm.org/viewvc/llvm-project?rev=298979&view=rev
Log:
Make flask sessions permanent
By default, Flask sessions only last while your browser is open. This changes the sessions to last forever. Since we store some page defaults and baselines in the session, we want sessions to last as long as possible.
Modified:
lnt/trunk/lnt/server/ui/app.py
Modified: lnt/trunk/lnt/server/ui/app.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/app.py?rev=298979&r1=298978&r2=298979&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/app.py (original)
+++ lnt/trunk/lnt/server/ui/app.py Wed Mar 29 00:49:50 2017
@@ -10,6 +10,7 @@ import traceback
import flask
from flask import current_app
+from flask import session
from flask import request
from flask import g
from flask import url_for
@@ -131,6 +132,11 @@ class App(LNTExceptionLoggerFlask):
app.api = Api(app)
load_api_resources(app.api)
+ @app.before_request
+ def set_session():
+ """Make our session cookies last."""
+ session.permanent = True
+
return app
@staticmethod
@@ -154,7 +160,6 @@ class App(LNTExceptionLoggerFlask):
self.wsgi_app = RootSlashPatchMiddleware(self.wsgi_app)
self.logger.setLevel(logging.DEBUG)
-
def load_config(self, instance):
self.instance = instance
self.old_config = self.instance.config
More information about the llvm-commits
mailing list