當前位置: 首頁>>代碼示例>>Python>>正文


Python Ticket.renew方法代碼示例

本文整理匯總了Python中models.Ticket.renew方法的典型用法代碼示例。如果您正苦於以下問題:Python Ticket.renew方法的具體用法?Python Ticket.renew怎麽用?Python Ticket.renew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.Ticket的用法示例。


在下文中一共展示了Ticket.renew方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import renew [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)
開發者ID:josuebrunel,項目名稱:authentic2,代碼行數:31,代碼來源:views.py


注:本文中的models.Ticket.renew方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。