本文整理汇总了Python中radlibs.Client.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Client.delete方法的具体用法?Python Client.delete怎么用?Python Client.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类radlibs.Client
的用法示例。
在下文中一共展示了Client.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_email
# 需要导入模块: from radlibs import Client [as 别名]
# 或者: from radlibs.Client import delete [as 别名]
def verify_email(token):
db_session = Client().session()
try:
verification_token = db_session.query(EmailVerificationToken).\
filter(EmailVerificationToken.token == token).\
one()
user = db_session.query(User).\
filter(User.user_id == verification_token.user_id).\
one()
except NoResultFound:
abort(404)
user.email_verified_at = utcnow()
db_session.add(user)
db_session.delete(verification_token)
return render_template('verification_complete.html.jinja')
示例2: accept_invitation
# 需要导入模块: from radlibs import Client [as 别名]
# 或者: from radlibs.Client import delete [as 别名]
def accept_invitation(token):
if not g.user:
return render_template('invitation_registration.html.jinja')
session = Client().session()
try:
invite = session.query(AssociationInvite).\
filter(AssociationInvite.token == token).\
one()
except NoResultFound:
abort(404)
if invite.email != g.user.email:
raise StandardError('Logged-in user had email {0} and a token for an '
'invite for {1}'.format(g.user.email, invite.email))
session.add(UserAssociation(association_id=invite.association_id,
user_id=g.user.user_id))
session.delete(invite)
if g.user.email_verified_at is None:
g.user.email_verified_at = utcnow()
session.add(g.user)
return redirect(url_for('manage_association',
association_id=invite.association_id))