本文整理汇总了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))