当前位置: 首页>>代码示例>>Python>>正文


Python Client.delete方法代码示例

本文整理汇总了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')
开发者ID:ErinCall,项目名称:radlibs,代码行数:19,代码来源:login.py

示例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))
开发者ID:ErinCall,项目名称:radlibs,代码行数:24,代码来源:association.py


注:本文中的radlibs.Client.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。