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