當前位置: 首頁>>代碼示例>>Python>>正文


Python DatabaseManager.genkey方法代碼示例

本文整理匯總了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:
開發者ID:SecurityInnovation,項目名稱:want2hack,代碼行數:33,代碼來源:app_routes.py


注:本文中的DatabaseManager.DatabaseManager.genkey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。