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