本文整理汇总了Python中user.User.delete方法的典型用法代码示例。如果您正苦于以下问题:Python User.delete方法的具体用法?Python User.delete怎么用?Python User.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.User
的用法示例。
在下文中一共展示了User.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: user
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import delete [as 别名]
def user():
if request.method == 'POST':
setting = request.form.get('setting')
user_id = request.form.get('value_0')
value = request.form.get('value_1')
if not setting or not user_id:
abort(400)
try:
user_id = int(user_id)
except:
abort(400)
user = User(id=user_id)
if not user.id:
flash(messages.user_not_found)
return render_template('admin/user.html',
user_list=get_user_list())
if setting == 'password':
if not value:
abort(400)
user.set_password(value)
flash(messages.user_set_password)
elif setting == 'delete':
user.delete()
flash(messages.user_deleted)
return redirect(url_for('admin_user'))
elif setting == 'activate':
if not value:
abort(400)
if value == 'True':
user.update_setting('active', True)
flash(messages.user_activated)
else:
user.update_setting('active', False)
flash(messages.user_deactivated)
return redirect(url_for('admin_user_details', id=user.id))
else:
abort(400)
users = get_user_list()
return render_template('admin/user.html', user_list=users)
示例2: config_sii
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import delete [as 别名]
def config_sii(bot, update):
try:
data = update.message.text.replace(siitag, '').split()
u = User(update.message.chat_id)
if data[0] == 'update':
data = data[1:]
result = u.update_data(data)
elif data[0] == 'set':
data = data[1:]
result = u.register(data)
elif data[0] == 'delete':
result = u.delete()
else:
result = 'Comando no reconocido'
send_message(bot, update, result)
except StandardError:
send_message(bot, update, 'Ocurrió un error, revise su comando')
示例3: raw_input
# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import delete [as 别名]
user.update(new_email, bcrypt.hashpw(new_password, bcrypt.gensalt(10)))
user.email = new_email
user.password = new_password
elif command == "delete":
if not user:
print "Please login first"
continue
confirm = raw_input("Are you sure? Y/n: ")
if confirm == "Y" or confirm == "y" or confirm == "yes" or confirm == "Yes":
print "deleting %s with password %s" % (user.email, user.password)
user.delete()
user = None
elif command == "create":
email = raw_input("Email: ")
password = getpass.getpass("Password: ")
password_confirm = getpass.getpass("Confirm Password: ")
while password != password_confirm:
print "Passwords do no match"
password = getpass.getpass("Password: ")
password_confirm = getpass.getpass("Confirm Password: ")
user = User(email, password, '', host)
user.create(bcrypt.hashpw(password, bcrypt.gensalt(10)))
elif command == "users":