當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。