本文整理匯總了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