本文整理汇总了Python中models.Ticket.deactivate_others方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.deactivate_others方法的具体用法?Python Ticket.deactivate_others怎么用?Python Ticket.deactivate_others使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Ticket
的用法示例。
在下文中一共展示了Ticket.deactivate_others方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import deactivate_others [as 别名]
def post(self):
session = get_current_session()
email = helper.sanitizeHtml(self.request.get('email'))
if len(email) > 1:
users = User.all().filter("email =", email).fetch(1)
if len(users) == 1:
if session.is_active():
session.terminate()
user = users[0]
Ticket.deactivate_others(user)
ticket = Ticket(user=user,code=Ticket.create_code(user.password + user.nickname + str(random.random())))
ticket.put()
code = ticket.code
host = self.request.url.replace(self.request.path,'',1)
sender = "Santiago Zavala - Fogata.co <[email protected]>"
logging.info("sender = " + sender )
mail.send_mail(sender=sender,
to=user.nickname + "<"+user.email+">",
subject="Liga para restablecer password",
html=template.render('templates/mail/forgotten-password-email.html', locals()),
body=template.render('templates/mail/forgotten-password-email-plain.html', locals()))
session['forgotten_password_ok'] = "Se ha enviado un correo electrónico a tu bandeja de entrada con las instrucciones"
else:
session['forgotten_password_error'] = "El correo electronico <strong>"+ email +"</strong> no existe en nuestra base de datos"
else:
session['forgotten_password_error'] = "Debes especificar tu correo electrónico"
self.redirect('/olvide-el-password')