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


Python security.forget方法代碼示例

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


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

示例1: logout_cookie_view

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def logout_cookie_view(request):
    headers = forget(request)
    return Response(status=200, headers=headers, body="OK") 
開發者ID:wichert,項目名稱:pyramid_jwt,代碼行數:5,代碼來源:test_integration.py

示例2: logout_view

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def logout_view(request):
    headers = forget(request)
    return HTTPFound(location='/', headers=headers) 
開發者ID:Akagi201,項目名稱:learning-python,代碼行數:5,代碼來源:views.py

示例3: logout

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def logout(self):
        next = self._query_params.get('next')
        headers = forget(self.request)
        if next:
            return JHTTPFound(location=next, headers=headers)
        return JHTTPOk('Logged out', headers=headers) 
開發者ID:ramses-tech,項目名稱:nefertari,代碼行數:8,代碼來源:views.py

示例4: admin_sign_out

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def admin_sign_out(self):
        headers = forget(self.request)
        url = self.request.route_url("admin_action", action="sign_in")
        return HTTPFound(url, headers=headers) 
開發者ID:Channelstream,項目名稱:channelstream,代碼行數:6,代碼來源:server.py

示例5: _check_tarif_control

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def _check_tarif_control(request, company):
    """check the possibility to make request from current IP
    """
    if not get_tarifs():
        return

    ip_limit = cast_int(company.settings.get('tarif_limit'))
    if not ip_limit:
        return

    ips = company.settings.get('tarif_ips', [])
    new_ips = []
    timeout = get_tarifs_timeout()
    ip_already_in = False
    dt_format = '%Y-%m-%dT%H:%M:%S'
    for ip, last_activity in ips:
        last_activity = datetime.strptime(last_activity, dt_format)
        if (
            (last_activity + timedelta(seconds=timeout)) <= datetime.now()
            and ip != request.client_addr
        ):
            continue
        elif ip == request.client_addr:
            new_ips.append((ip, datetime.now().strftime(dt_format)))
            ip_already_in = True
        else:
            new_ips.append((ip, last_activity.strftime(dt_format)))

    if len(new_ips) >= ip_limit and not ip_already_in:
        log.error(_(u'IP limit exceeded'))
        redirect_url = request.resource_url(Root(request))
        raise HTTPFound(location=redirect_url, headers=forget(request))
    if not ip_already_in:
        new_ips.append(
            (request.client_addr, datetime.now().strftime(dt_format))
        )
    settings = copy.copy(company.settings)
    settings['tarif_ips'] = new_ips
    company.settings = settings 
開發者ID:mazvv,項目名稱:travelcrm,代碼行數:41,代碼來源:__init__.py

示例6: company_settings

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def company_settings(event):
    request = event.request
    employee = get_auth_employee(request)
    if not employee:
        _company_settings(request, get_company())
        return
    structure = get_employee_structure(employee)
    if not structure:
        redirect_url = request.resource_url(Root(request))
        raise HTTPFound(location=redirect_url, headers=forget(request))
    _check_tarif_control(request, structure.company)
    _company_settings(request, structure.company) 
開發者ID:mazvv,項目名稱:travelcrm,代碼行數:14,代碼來源:__init__.py

示例7: logout

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def logout(request):
    security.forget(request)
    request.session.invalidate()
    return HTTPFound(location=request.route_url('index')) 
開發者ID:muesli-hd,項目名稱:muesli,代碼行數:6,代碼來源:viewsUser.py

示例8: update

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def update(self):
        self.execute(None)
        headers = forget(self.request)
        return HTTPFound(location = self.request.resource_url(
                                         self.request.context),
                     headers = headers) 
開發者ID:ecreall,項目名稱:nova-ideo,代碼行數:8,代碼來源:logout.py

示例9: logout

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def logout(context, request):
    headers = forget(request)
    data = {
        'status': True
    }
    return Response(json=data, status=200, headerlist=headers) 
開發者ID:ecreall,項目名稱:nova-ideo,代碼行數:8,代碼來源:views.py

示例10: render

# 需要導入模塊: from pyramid import security [as 別名]
# 或者: from pyramid.security import forget [as 別名]
def render(self):

        return HTTPFound(location=route_url('index', self.request),
                         headers=forget(self.request)) 
開發者ID:sayoun,項目名稱:pyvac,代碼行數:6,代碼來源:credentials.py


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