374 class DeleteEntitiesStep(Step): |
374 class DeleteEntitiesStep(Step): |
375 """step consisting in deleting entities""" |
375 """step consisting in deleting entities""" |
376 |
376 |
377 def execute(self): |
377 def execute(self): |
378 """execute this step""" |
378 """execute this step""" |
|
379 results = self.execute_child() |
379 todelete = frozenset(typed_eid(eid) for eid, in self.execute_child()) |
380 todelete = frozenset(typed_eid(eid) for eid, in self.execute_child()) |
380 session = self.plan.session |
381 session = self.plan.session |
381 delete = session.repo.glob_delete_entity |
382 delete = session.repo.glob_delete_entity |
382 # register pending eids first to avoid multiple deletion |
383 # register pending eids first to avoid multiple deletion |
383 pending = session.transaction_data.setdefault('pendingeids', set()) |
384 pending = session.transaction_data.setdefault('pendingeids', set()) |
384 actual = todelete - pending |
385 actual = todelete - pending |
385 pending |= actual |
386 pending |= actual |
386 for eid in actual: |
387 for eid in actual: |
387 delete(session, eid) |
388 delete(session, eid) |
388 |
389 return results |
389 |
390 |
390 class DeleteRelationsStep(Step): |
391 class DeleteRelationsStep(Step): |
391 """step consisting in deleting relations""" |
392 """step consisting in deleting relations""" |
392 |
393 |
393 def __init__(self, plan, rtype): |
394 def __init__(self, plan, rtype): |