本文整理汇总了Python中c2corg_api.models.DBSession.delete方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.delete方法的具体用法?Python DBSession.delete怎么用?Python DBSession.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类c2corg_api.models.DBSession
的用法示例。
在下文中一共展示了DBSession.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: collection_delete
# 需要导入模块: from c2corg_api.models import DBSession [as 别名]
# 或者: from c2corg_api.models.DBSession import delete [as 别名]
def collection_delete(self):
association_in = schema_association.objectify(self.request.validated)
association = self._load(association_in)
if association is None:
# also accept {parent_document_id: y, child_document_id: x} when
# for an association {parent_document_id: x, child_document_id: x}
association_in = Association(
parent_document_id=association_in.child_document_id,
child_document_id=association_in.parent_document_id)
association = self._load(association_in)
if association is None:
raise HTTPBadRequest('association does not exist')
if is_main_waypoint_association(association):
raise HTTPBadRequest(
'as the main waypoint of the route, this waypoint can not '
'be disassociated')
log = association.get_log(
self.request.authenticated_userid, is_creation=False)
DBSession.delete(association)
DBSession.add(log)
return {}
示例2: collection_delete
# 需要导入模块: from c2corg_api.models import DBSession [as 别名]
# 或者: from c2corg_api.models.DBSession import delete [as 别名]
def collection_delete(self):
association_in = schema_association.objectify(self.request.validated)
association = self._load(association_in)
if association is None:
# also accept {parent_document_id: y, child_document_id: x} when
# for an association {parent_document_id: x, child_document_id: x}
association_in = Association(
parent_document_id=association_in.child_document_id,
child_document_id=association_in.parent_document_id)
association = self._load(association_in)
if association is None:
raise HTTPBadRequest('association does not exist')
_check_required_associations(association)
check_permission_for_association_removal(self.request, association)
log = association.get_log(
self.request.authenticated_userid, is_creation=False)
DBSession.delete(association)
DBSession.add(log)
update_cache_version_associations(
[],
[{'parent_id': association.parent_document_id,
'parent_type': association.parent_document_type,
'child_id': association.child_document_id,
'child_type': association.child_document_type}])
notify_es_syncer_if_needed(association, self.request)
update_feed_association_update(
association.parent_document_id, association.parent_document_type,
association.child_document_id, association.child_document_type,
self.request.authenticated_userid)
return {}