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


Python Session.delete方法代码示例

本文整理汇总了Python中abstrackr.model.meta.Session.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Session.delete方法的具体用法?Python Session.delete怎么用?Python Session.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在abstrackr.model.meta.Session的用法示例。


在下文中一共展示了Session.delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: confirm_password_reset

# 需要导入模块: from abstrackr.model.meta import Session [as 别名]
# 或者: from abstrackr.model.meta.Session import delete [as 别名]
 def confirm_password_reset(self, id):
     token = str(id)
     reset_pwd_q = Session.query(model.ResetPassword)
     # we pull all in case they've tried to reset their pwd a few times
     # by the way, these should time-expire...
     matches = reset_pwd_q.filter(model.ResetPassword.token == token).all()
     if len(matches) == 0:
         return """
             Hrmm... It looks like you're trying to reset your password, but I can't match the provided token.
             Please go back to the email that was sent to you and make sure you've copied the URL correctly.
             """
     user = controller_globals._get_user_from_email(matches[0].user_email)
     for match in matches:
         Session.delete(match)
     user._set_password(token)
     Session.commit()
     return '''
       ok! your password has been set to %s (you can change it once you've logged in).\n
       <a href="%s">log in here</a>.''' % (token, url('/', qualified=True))
开发者ID:shihikoo,项目名称:abstrackr-web,代码行数:21,代码来源:account.py


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