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


Python DatabaseManager.get_user方法代碼示例

本文整理匯總了Python中DatabaseManager.DatabaseManager.get_user方法的典型用法代碼示例。如果您正苦於以下問題:Python DatabaseManager.get_user方法的具體用法?Python DatabaseManager.get_user怎麽用?Python DatabaseManager.get_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DatabaseManager.DatabaseManager的用法示例。


在下文中一共展示了DatabaseManager.get_user方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: flash

# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import get_user [as 別名]
	try:
		attack = db_man.get_attacks(user_id=g.user['user_id'], challenge_id=challenge_id)[0]
	except:
		attack = None

	difficulty_estimate = db_man.get_difficulty_estimate(challenge_id=challenge_id, version=challenge['latest_version'])[0]
	if(request.method == "POST"):
		publish = request.form.get('publish')
		if publish is not None:
			if(db_man.publish(challenge_id=challenge_id, latest_version=challenge['latest_version'], difficulty_estimate=difficulty_estimate)):
				file_man.publish(challenge_id=challenge_id)
				flash('The challenge has been submitted for approval, you are now working on the new one.')
				msg = Message("Challenge Awaiting Approval")
				msg.recipients = []
				for user in app.config['ADMIN_USERS']:
					email = db_man.get_user(username=user)['email']
					msg.recipients.append(email)
				msg.html =  '''
							A challenge is awaiting approval on %s.
							''' % (app.config['SERVER_NAME'])
				try:
					app.config['MAIL'].send(msg)
				except Exception, e:
					app.logger.warning('The "challenge is awaiting approval" message was not sent because off ' + str(e))

		else:
			name = request.form['name']
			difficulty=int(request.form['difficulty'])
			description = request.form['description']
			if(re.match(app.config['USERNAME_REGEX'], name) is None or difficulty < 1 or difficulty > 5):
				flash('Those inputs were invalid, '+app.config['USERNAME_REGEX']+' is allowed')
開發者ID:SecurityInnovation,項目名稱:want2hack,代碼行數:33,代碼來源:app_routes.py


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