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


Python DatabaseManager.update_challenge方法代碼示例

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


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

示例1: str

# 需要導入模塊: from DatabaseManager import DatabaseManager [as 別名]
# 或者: from DatabaseManager.DatabaseManager import update_challenge [as 別名]
				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')
				return redirect('/dashboard/challenge/'+str(challenge_id))
			success = db_man.update_challenge(challenge_id=challenge_id, name=name, difficulty=difficulty, version=challenge['latest_version'], description=description)
			if(success):
				flash('The settings have been changed')
			else:
				flash('There was an error in saving the settings')
		return redirect('/dashboard/challenge/'+str(challenge_id))
	if challenge is not None:
		files = file_man.get_files(challenge_id)
		if files is None:
			return(abort(418))
		difficulty_estimate = db_man.get_difficulty_estimate(challenge_id=challenge_id, version=challenge['latest_version'])[0]
		return render_template('pages/edit.html',challenge=challenge, files=files, attack=attack, difficulty=difficulty_estimate)
	return redirect('/dashboard')

# Adds a file to the challenge
@app.route('/dashboard/challenge/add_file/<int:challenge_id>', methods=['POST'])# POST only => re:dashboard
開發者ID:SecurityInnovation,項目名稱:want2hack,代碼行數:33,代碼來源:app_routes.py


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