当前位置: 首页>>代码示例>>Python>>正文


Python UserModel.delete_extra_ip方法代码示例

本文整理汇总了Python中kallithea.model.user.UserModel.delete_extra_ip方法的典型用法代码示例。如果您正苦于以下问题:Python UserModel.delete_extra_ip方法的具体用法?Python UserModel.delete_extra_ip怎么用?Python UserModel.delete_extra_ip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kallithea.model.user.UserModel的用法示例。


在下文中一共展示了UserModel.delete_extra_ip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_ip

# 需要导入模块: from kallithea.model.user import UserModel [as 别名]
# 或者: from kallithea.model.user.UserModel import delete_extra_ip [as 别名]
    def delete_ip(self, id):
        ip_id = request.POST.get('del_ip_id')
        user_model = UserModel()
        user_model.delete_extra_ip(id, ip_id)
        Session().commit()
        h.flash(_("Removed IP address from user whitelist"), category='success')

        if 'default_user' in request.POST:
            raise HTTPFound(location=url('admin_permissions_ips'))
        raise HTTPFound(location=url('edit_user_ips', id=id))
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:12,代码来源:users.py

示例2: delete_ip

# 需要导入模块: from kallithea.model.user import UserModel [as 别名]
# 或者: from kallithea.model.user.UserModel import delete_extra_ip [as 别名]
    def delete_ip(self, id):
        """DELETE /user_ips_delete/id: Delete an existing item"""
        # url('user_ips_delete', id=ID, method='delete')
        ip_id = request.POST.get('del_ip_id')
        user_model = UserModel()
        user_model.delete_extra_ip(id, ip_id)
        Session().commit()
        h.flash(_("Removed ip address from user whitelist"), category='success')

        if 'default_user' in request.POST:
            return redirect(url('admin_permissions_ips'))
        return redirect(url('edit_user_ips', id=id))
开发者ID:zhumengyuan,项目名称:kallithea,代码行数:14,代码来源:users.py

示例3: auto_clear_ip_permissions

# 需要导入模块: from kallithea.model.user import UserModel [as 别名]
# 或者: from kallithea.model.user.UserModel import delete_extra_ip [as 别名]
def auto_clear_ip_permissions():
    """Fixture that provides nothing but clearing IP permissions upon test
    exit. This clearing is needed to avoid other test failing to make fake http
    accesses."""
    yield
    # cleanup
    user_model = UserModel()

    user_ids = []
    user_ids.append(User.get_default_user().user_id)
    user_ids.append(User.get_by_username(TEST_USER_REGULAR_LOGIN).user_id)

    for user_id in user_ids:
        for ip in UserIpMap.query().filter(UserIpMap.user_id == user_id):
            user_model.delete_extra_ip(user_id, ip.ip_id)

    # IP permissions are cached, need to invalidate this cache explicitly
    invalidate_all_caches()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:20,代码来源:conftest.py


注:本文中的kallithea.model.user.UserModel.delete_extra_ip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。