本文整理匯總了Python中models.Ticket.service_url方法的典型用法代碼示例。如果您正苦於以下問題:Python Ticket.service_url方法的具體用法?Python Ticket.service_url怎麽用?Python Ticket.service_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Ticket
的用法示例。
在下文中一共展示了Ticket.service_url方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get
# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import service_url [as 別名]
def get(self, request):
service = request.GET.get(SERVICE_PARAM)
renew = request.GET.get(RENEW_PARAM) is not None
gateway = request.GET.get(GATEWAY_PARAM) is not None
if not service:
return self.failure(request, '', 'no service field')
model = Service.objects.for_service(service)
if not model:
return self.failure(request, service, 'service unknown')
if renew and gateway:
return self.failure(request, service, 'renew and gateway cannot be requested '
'at the same time')
st = Ticket()
st.service = model
st.service_url = service
st.renew = renew
self.logger.debug('login request from %r renew: %s gateway: %s',
service, renew, gateway)
if self.must_authenticate(request, renew, gateway):
st.save()
return self.authenticate(request, st)
self.validate_ticket(request, st)
if st.valid():
st.save()
return redirect(request, service, params={'ticket': st.ticket_id})
self.logger.debug('gateway requested but no session is open')
return redirect(request, service)