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


Python Session.delete方法代码示例

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


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

示例1: destroy_comment

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
 def destroy_comment(self, id, commentid):
     comment = Session.query(NodeComment)\
             .filter(NodeComment.id == commentid).first()
     Session.delete(comment)
     Session.commit()
     return redirect(url(
         controller='nodes', action='show', id=id))
开发者ID:seryl,项目名称:Nodetraq,代码行数:9,代码来源:nodes.py

示例2: destroy_game

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
    def destroy_game(self, id):
        game = Session.query(Game).filter(Game.id == id).first()
        Session.delete(game)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
开发者ID:seryl,项目名称:Nodetraq,代码行数:10,代码来源:nodes.py

示例3: destroy_studio

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
    def destroy_studio(self, id):
        studio = Session.query(Studio).filter(Studio.id == id).first()
        Session.delete(studio)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
开发者ID:seryl,项目名称:Nodetraq,代码行数:10,代码来源:nodes.py

示例4: destroy

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
    def destroy(self, id, backup_id):
        dbbackup = Session.query(NodeDatabaseBackup)\
            .filter(NodeDatabaseBackup.id == backup_id).first()
        Session.delete(dbbackup)
        Session.commit()
        session['flash'] = "Successfully destroyed dbbackup"
        session.save()

        return redirect(url(controller='dbbackups', action='index', id=id))
开发者ID:seryl,项目名称:Nodetraq,代码行数:11,代码来源:dbbackups.py

示例5: delete

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
    def delete(self, id):
        if id.isdigit():
            graph = Session.query(Graph)\
                .filter(Graph.id == int(id)).first()
        else:
            graph = Session.query(Graph)\
                .filter(Graph.name == id).first()

        Session.delete(graph)
        Session.commit()
        session['flash'] = "Successfully deleted %s" % graph.name
        session.save()
        return redirect(url(
                controller='graphs', action='index'))
开发者ID:seryl,项目名称:Nodetraq,代码行数:16,代码来源:graphs.py

示例6: update_disks

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
    def update_disks(self, diskinfo):
        if self.disks:
            current_serials = [d.serial_no for d in self.disks]
            new_serials = [d["serial_no"] for d in diskinfo["disks"]]
            diff_serials = list(set(new_serials) - set(current_serials))
            remove_serials = [serial for serial in current_serials if serial not in new_serials]

            for s in remove_serials:
                for rd in self.disks:
                    if rd.serial_no == s:
                        self.disks.remove(rd)
                        Session.delete(rd)

            for s in diff_serials:
                for disk in diskinfo["disks"]:
                    if disk["serial_no"] == s:
                        new_disk = Disk()
                        new_disk.serial_no = disk["serial_no"]
                        new_disk.capacity = disk["capacity"]
                        new_disk.type = disk["type"]
                        new_disk.controller_slot = disk["controller_slot"]
                        new_disk.controller_id = DiskController.grab_controller(disk["controller"])
                        Session.add(new_disk)
                        self.disks.append(new_disk)

        else:
            self.disks = []
            for disk in diskinfo["disks"]:
                new_disk = Disk()
                new_disk.serial_no = disk["serial_no"]
                new_disk.capacity = disk["capacity"]
                new_disk.type = disk["type"]
                new_disk.controller_slot = disk["controller_slot"]
                new_disk.controller_id = DiskController.grab_controller(disk["controller"])
                Session.add(new_disk)
                self.disks.append(new_disk)

        Session.add(self)
        Session.commit()
开发者ID:seryl,项目名称:Nodetraq,代码行数:41,代码来源:nodes.py

示例7: delete

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
 def delete(self, backup_id):
     dbbackup = Session.query(NodeDatabaseBackup)\
         .filter(NodeDatabaseBackup.id == backup_id).first()
     Session.delete(dbbackup)
     Session.commit()
     return {"success": True}
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:dbbackups.py

示例8: destroy

# 需要导入模块: from nodetraq.model.meta import Session [as 别名]
# 或者: from nodetraq.model.meta.Session import delete [as 别名]
 def destroy(self, id):
     network_device = Session.query(NetworkDevice).filter(
         NetworkDevice.id == id).first()
     Session.delete(network_device)
     Session.commit()
     return {'success': True}
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:network.py


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