本文整理匯總了Python中models.Ticket.all方法的典型用法代碼示例。如果您正苦於以下問題:Python Ticket.all方法的具體用法?Python Ticket.all怎麽用?Python Ticket.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Ticket
的用法示例。
在下文中一共展示了Ticket.all方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import all [as 別名]
def get(self,code):
session = get_current_session()
code = helper.parse_post_id(code)
if session.has_key('error'):
error = session['error']
ticket = Ticket.all().filter('code',code).filter('is_active',True).fetch(1)
if len(ticket) == 1:
ticket = ticket[0]
self.response.out.write(template.render('templates/new-password.html', locals()))
else:
self.redirect('/')
示例2: post
# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import all [as 別名]
def post(self,code):
session = get_current_session()
code = helper.parse_post_id(helper.sanitizeHtml(self.request.get('code')))
password = helper.sanitizeHtml(self.request.get('password'))
password_confirm = helper.sanitizeHtml(self.request.get('password_confirm'))
if password != password_confirm :
session['error'] = "Ocurrió un error al confirmar el password"
self.redirect('/recovery/'+code)
return
ticket = Ticket.all().filter('code',code).filter('is_active',True).fetch(1)
if len(ticket) == 1:
ticket = ticket[0]
user = ticket.user
user.password = User.slow_hash(password)
user.put()
ticket.is_active = False
ticket.put()
session['success'] = "Se ha cambiado el password correctamente, ya puedes iniciar sesión con tus nuevas credenciales"
self.redirect('/login')
else:
self.redirect('/')
示例3: get_tickets
# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import all [as 別名]
def get_tickets():
tickets = Ticket.all()
return render_template("tickets.html", tickets=tickets)