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