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


Python Session.delete方法代码示例

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


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

示例1: remove_pnfdev

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_pnfdev(self, pnfdev):
        """Remove a PNFDev from the Tenant.

        Args:
            addr, a PNFDev object

        Returns:
            None
        Raises:
            KeyError, if the pnfdev is not available
        """

        pnfdevs = getattr(self, pnfdev.ALIAS)

        if pnfdev.addr not in pnfdevs:
            return

        del pnfdevs[pnfdev.addr]

        belongs = Session().query(TblBelongs) \
                           .filter(TblBelongs.tenant_id == self.tenant_id,
                                   TblBelongs.addr == pnfdev.addr) \
                           .first()

        session = Session()
        session.delete(belongs)
        session.commit()
开发者ID:archam,项目名称:empower-runtime,代码行数:29,代码来源:tenant.py

示例2: reject_tenant

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def reject_tenant(cls, tenant_id):
        """Reject previously requested Tenant."""

        pending = Session().query(TblPendingTenant) \
            .filter(TblPendingTenant.tenant_id == tenant_id) \
            .first()

        if not pending:
            raise KeyError(tenant_id)

        session = Session()
        session.delete(pending)
        session.commit()
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:15,代码来源:core.py

示例3: remove_denied

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_denied(self, sta_addr):
        """ Remove entry from ACL. """

        deny = Session().query(TblDeny) \
                        .filter(TblDeny.addr == sta_addr) \
                        .first()
        if not deny:
            raise KeyError(sta_addr)

        session = Session()
        session.delete(deny)
        session.commit()

        del self.denied[sta_addr]
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:16,代码来源:core.py

示例4: remove_allowed

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_allowed(self, sta_addr):
        """ Remove entry from ACL. """

        allow = Session().query(TblAllow) \
                         .filter(TblAllow.addr == sta_addr) \
                         .first()
        if not allow:
            raise KeyError(sta_addr)

        session = Session()
        session.delete(allow)
        session.commit()

        del self.allowed[sta_addr]
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:16,代码来源:core.py

示例5: remove_imsi2mac

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_imsi2mac(self, imsi):
        """Remove IMSI to MAC mapped value from table."""

        imsi2mac = Session().query(TblIMSI2MAC) \
                         .filter(TblIMSI2MAC.imsi == imsi) \
                         .first()
        if not imsi2mac:
            raise KeyError(imsi)

        session = Session()
        session.delete(imsi2mac)
        session.commit()

        del self.imsi2mac[imsi]
开发者ID:5g-empower,项目名称:empower-runtime,代码行数:16,代码来源:core.py

示例6: remove_feed

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_feed(self, feed_id):
        """Remove Feed."""

        if feed_id not in RUNTIME.feeds:
            raise KeyError(feed_id)

        self.bind_feed(feed_id)
        del RUNTIME.feeds[feed_id]

        feed = Session().query(TblFeed) \
                        .filter(TblFeed.feed_id == feed_id) \
                        .first()

        session = Session()
        session.delete(feed)
        session.commit()
开发者ID:archam,项目名称:empower-runtime,代码行数:18,代码来源:energinoserver.py

示例7: remove_tenant

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_tenant(self, tenant_id):
        """Delete existing Tenant."""

        if tenant_id not in self.tenants:
            raise KeyError(tenant_id)

        tenant = self.tenants[tenant_id]

        # remove pnfdev in this tenant
        devs = Session().query(TblBelongs) \
                        .filter(TblBelongs.tenant_id == tenant_id)

        for dev in devs:
            session = Session()
            session.delete(dev)
            session.commit()

        # remove tenant
        del self.tenants[tenant_id]

        tenant = Session().query(TblTenant) \
                          .filter(TblTenant.tenant_id == tenant_id) \
                          .first()

        session = Session()
        session.delete(tenant)
        session.commit()

        # remove running modules
        for component in self.components.values():

            if not hasattr(component, 'modules'):
                continue

            to_be_removed = []

            for module in component.modules.values():
                if module.tenant_id == tenant_id:
                    to_be_removed.append(module.module_id)

            for module_id in to_be_removed:
                component.remove_module(module_id)
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:44,代码来源:core.py

示例8: remove_account

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_account(self, username):
        """Remove an account."""

        if username == 'root':
            raise ValueError("Cannot removed root account")

        account = Session().query(TblAccount) \
                           .filter(TblAccount.username == str(username)) \
                           .first()
        if not account:
            raise KeyError(username)

        session = Session()
        session.delete(account)
        session.commit()

        del self.accounts[username]
        to_be_deleted = [x.tenant_id for x in self.tenants.values()
                         if x.owner == username]

        for tenant_id in to_be_deleted:
            self.remove_tenant(tenant_id)
开发者ID:Panagiotis-Kon,项目名称:empower-runtime,代码行数:24,代码来源:core.py

示例9: remove_pnfdev

# 需要导入模块: from empower.persistence import Session [as 别名]
# 或者: from empower.persistence.Session import delete [as 别名]
    def remove_pnfdev(self, addr):
        """Remove PNFDev."""

        if addr not in self.pnfdevs:
            raise KeyError(addr)

        pnfdev = self.pnfdevs[addr]

        for tenant in RUNTIME.tenants.values():

            tenant_pnfdevs = getattr(tenant, self.PNFDEV.ALIAS)

            if addr in tenant_pnfdevs:
                tenant.remove_pnfdev(pnfdev)

        del self.pnfdevs[addr]

        pnfdev = Session().query(self.TBL_PNFDEV) \
            .filter(self.TBL_PNFDEV.addr == addr) \
            .first()

        session = Session()
        session.delete(pnfdev)
        session.commit()
开发者ID:gastontelfe,项目名称:empower-runtime,代码行数:26,代码来源:pnfpserver.py


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