本文整理汇总了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))
示例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}
示例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}
示例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))
示例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'))
示例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()
示例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}
示例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}