本文整理汇总了Python中inpho.model.Session.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Session.delete方法的具体用法?Python Session.delete怎么用?Python Session.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inpho.model.Session
的用法示例。
在下文中一共展示了Session.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_obj
# 需要导入模块: from inpho.model import Session [as 别名]
# 或者: from inpho.model.Session import delete [as 别名]
def delete_obj(obj):
"""
Deletes any arbitrary object from the SQLAlchemy Session and cascades deletes to evaluations.
:param obj: object to delete
"""
Session.delete(obj)
Session.flush()
Session.commit()
示例2: _delete_date
# 需要导入模块: from inpho.model import Session [as 别名]
# 或者: from inpho.model.Session import delete [as 别名]
def _delete_date(self, id, id2):
c.entity = h.fetch_obj(Entity, id, new_id=True)
# get the date object
date = self._get_date(id, id2)
if date in c.entity.dates:
idx = c.entity.dates.index(date)
Session.delete(c.entity.dates[idx])
Session.commit()
return "OK"
示例3: _delete_searchpatterns
# 需要导入模块: from inpho.model import Session [as 别名]
# 或者: from inpho.model.Session import delete [as 别名]
def _delete_searchpatterns(self, id):
c.entity = h.fetch_obj(Entity, id, new_id=True)
# add a new search pattern
pattern = request.params.get("pattern", None)
if pattern is None:
abort(400)
pattern = pattern.strip()
# Boneheaded working around bogus associationproxy in SQLAlchemy 0.6.8
# Why this isn't just c.entity.searchpatterns.remove(pattern)? who knows
for spattern in c.entity._spatterns:
if spattern.searchpattern == pattern:
Session.delete(spattern)
Session.commit()
return "OK"