当前位置: 首页>>代码示例>>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;未经允许,请勿转载。