本文整理匯總了Python中coprs.logic.users_logic.UsersLogic.raise_if_cant_update_copr方法的典型用法代碼示例。如果您正苦於以下問題:Python UsersLogic.raise_if_cant_update_copr方法的具體用法?Python UsersLogic.raise_if_cant_update_copr怎麽用?Python UsersLogic.raise_if_cant_update_copr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類coprs.logic.users_logic.UsersLogic
的用法示例。
在下文中一共展示了UsersLogic.raise_if_cant_update_copr方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: remove_copr_chroot
# 需要導入模塊: from coprs.logic.users_logic import UsersLogic [as 別名]
# 或者: from coprs.logic.users_logic.UsersLogic import raise_if_cant_update_copr [as 別名]
def remove_copr_chroot(cls, user, copr_chroot):
"""
:param models.CoprChroot chroot:
"""
UsersLogic.raise_if_cant_update_copr(
user, copr_chroot.copr,
"Only owners and admins may update their projects.")
db.session.delete(copr_chroot)
示例2: remove_comps
# 需要導入模塊: from coprs.logic.users_logic import UsersLogic [as 別名]
# 或者: from coprs.logic.users_logic.UsersLogic import raise_if_cant_update_copr [as 別名]
def remove_comps(cls, user, copr_chroot):
UsersLogic.raise_if_cant_update_copr(
user, copr_chroot.copr,
"Only owners and admins may update their projects.")
copr_chroot.comps_name = None
copr_chroot.comps_zlib = None
ActionsLogic.send_update_comps(copr_chroot)
db.session.add(copr_chroot)
示例3: update_chroot
# 需要導入模塊: from coprs.logic.users_logic import UsersLogic [as 別名]
# 或者: from coprs.logic.users_logic.UsersLogic import raise_if_cant_update_copr [as 別名]
def update_chroot(cls, user, copr_chroot,
buildroot_pkgs, comps=None, comps_name=None):
"""
:type user: models.User
:type copr_chroot: models.CoprChroot
"""
UsersLogic.raise_if_cant_update_copr(
user, copr_chroot.copr,
"Only owners and admins may update their projects.")
cls._update_chroot(buildroot_pkgs, comps, comps_name, copr_chroot)
db.session.add(copr_chroot)
return copr_chroot
示例4: create_chroot
# 需要導入模塊: from coprs.logic.users_logic import UsersLogic [as 別名]
# 或者: from coprs.logic.users_logic.UsersLogic import raise_if_cant_update_copr [as 別名]
def create_chroot(cls, user, copr, mock_chroot,
buildroot_pkgs=None, comps=None, comps_name=None):
"""
:type user: models.User
:type mock_chroot: models.MockChroot
"""
if buildroot_pkgs is None:
buildroot_pkgs = ""
UsersLogic.raise_if_cant_update_copr(
user, copr,
"Only owners and admins may update their projects.")
chroot = models.CoprChroot(copr=copr, mock_chroot=mock_chroot)
cls._update_chroot(buildroot_pkgs, comps, comps_name, chroot)
return chroot
示例5: update_from_names
# 需要導入模塊: from coprs.logic.users_logic import UsersLogic [as 別名]
# 或者: from coprs.logic.users_logic.UsersLogic import raise_if_cant_update_copr [as 別名]
def update_from_names(cls, user, copr, names):
UsersLogic.raise_if_cant_update_copr(
user, copr,
"Only owners and admins may update their projects.")
current_chroots = copr.mock_chroots
new_chroots = cls.mock_chroots_from_names(names)
# add non-existing
for mock_chroot in new_chroots:
if mock_chroot not in current_chroots:
db.session.add(
models.CoprChroot(copr=copr, mock_chroot=mock_chroot))
# delete no more present
to_remove = []
for mock_chroot in current_chroots:
if mock_chroot not in new_chroots:
# can't delete here, it would change current_chroots and break
# iteration
to_remove.append(mock_chroot)
for mc in to_remove:
copr.mock_chroots.remove(mc)