|
@ -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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|