本文整理匯總了Python中DatabaseManager.DatabaseManager.genkey方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.genkey方法的具體用法?Python DatabaseManager.genkey怎麽用?Python DatabaseManager.genkey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DatabaseManager.DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager.genkey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: flash
# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import genkey [as 別名]
g.user = db_man.get_user(sesh=session['infsek_user'])
except KeyError, e :
g.user = None
if(request.method!='GET' and request.host==app.config['SERVER_NAME']):
try:
token = session['_csrf_token']
except:
flash('There was a problem with your session state, it should be resolved now.')
return redirect('/')
session['_csrf_token'] = None
if not token or token != request.form.get('_csrf_token'):
flash('You were just protected from CSRF, if this was in ERROR, Sorry.')
abort(403)
try:
if(session['_csrf_token'] is None):
session['_csrf_token'] = db_man.genkey(213)
g.csrf = session['_csrf_token']
except:
session['_csrf_token'] = db_man.genkey(213)
g.csrf = session['_csrf_token']
# in case something breaks
@app.teardown_request
def teardown_request(exception) :
# In case of breakage
g.conn.close()
# clean up if it all works.
@app.after_request
def record(response):
try: