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


Python State.isRemovable方法代码示例

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


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

示例1: removeOrCancel

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isRemovable [as 别名]
 def removeOrCancel(self, uService):
     if uService.isUsable() or State.isRemovable(uService.state):
         return self.remove(uService)
     elif uService.isPreparing():
         return self.cancel(uService)
     else:
         raise OperationException(_('Can\'t remove nor cancel {0} cause its states don\'t allow it'))
开发者ID:joaoguariglia,项目名称:openuds,代码行数:9,代码来源:UserServiceManager.py

示例2: remove

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isRemovable [as 别名]
    def remove(self, uService):
        '''
        Removes a uService element
        @return: the uService removed (marked for removal)
        '''
        uService = UserService.objects.get(id=uService.id)
        logger.debug('Removing uService {0}'.format(uService))
        if uService.isUsable() is False and State.isRemovable(uService.state) is False:
            raise OperationException(_('Can\'t remove a non active element'))

        ci = uService.getInstance()
        state = ci.destroy()
        uService.setState(State.REMOVING)
        UserServiceOpChecker.makeUnique(uService, ci, state)
开发者ID:aiminickwong,项目名称:openuds,代码行数:16,代码来源:UserServiceManager.py

示例3: unpublish

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isRemovable [as 别名]
 def unpublish(self, servicePoolPub):  # pylint: disable=no-self-use
     '''
     Unpublishes an active (usable) or removable publication
     :param servicePoolPub: Publication to unpublish
     '''
     if State.isUsable(servicePoolPub.state) is False and State.isRemovable(servicePoolPub.state) is False:
         raise PublishException(_('Can\'t unpublish non usable publication')
                                )
     if servicePoolPub.userServices.exclude(state__in=State.INFO_STATES).count() > 0:
         raise PublishException(_('Can\'t unpublish publications with services in process'))
     try:
         pubInstance = servicePoolPub.getInstance()
         state = pubInstance.destroy()
         servicePoolPub.setState(State.REMOVING)
         PublicationFinishChecker.checkAndUpdateState(servicePoolPub, pubInstance, state)
     except Exception, e:
         raise PublishException(str(e))
开发者ID:AlexeyBychkov,项目名称:openuds,代码行数:19,代码来源:PublicationManager.py

示例4: remove

# 需要导入模块: from uds.core.util.State import State [as 别名]
# 或者: from uds.core.util.State.State import isRemovable [as 别名]
    def remove(self, uService):
        '''
        Removes a uService element
        @return: the uService removed (marked for removal)
        '''
        with transaction.atomic():
            uService = UserService.objects.select_for_update().get(id=uService.id)
            logger.debug('Removing uService {0}'.format(uService))
            if uService.isUsable() is False and State.isRemovable(uService.state) is False:
                raise OperationException(_('Can\'t remove a non active element'))
            uService.setState(State.REMOVING)
            logger.debug("***** The state now is {}".format(State.toString(uService.state)))
            uService.setInUse(False)  # For accounting, ensure that it is not in use right now
            uService.save()

        ci = uService.getInstance()
        state = ci.destroy()

        UserServiceOpChecker.makeUnique(uService, ci, state)
开发者ID:joaoguariglia,项目名称:openuds,代码行数:21,代码来源:UserServiceManager.py


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