Browse Source

connect db flag

master
牛批的一批 5 years ago
parent
commit
29fbac4fd5
  1. 8
      server/jumpserver.py

8
server/jumpserver.py

@ -198,16 +198,18 @@ def checkCookie(request):
@app.before_request @app.before_request
def before_request(): def before_request():
g.db = connect_db()
g.isconnect_db = False
if request.path != "/sso" and (not checkCookie(request)): if request.path != "/sso" and (not checkCookie(request)):
return redirect_sso() return redirect_sso()
g.db = connect_db()
g.isconnect_db = True
@app.after_request @app.after_request
def after_request(response): def after_request(response):
if g.db != None:
if g.isconnect_db:
g.db.close() g.db.close()
g.db = None
return response return response

Loading…
Cancel
Save