def task_delete_txn(entity): """Performs all necessary operations in a single transaction when a task is deleted. """ to_delete = [] to_delete += gci_comment_logic.getForFields(ancestors=[entity]) to_delete += [entity] db.delete(to_delete)
def getFromKeyFieldsWithCWSOr404(self, fields): """Returns the Task, all Comments and all WorkSubmissions for the Task specified by the fields argument. For args see base.getFromKeyFieldsOr404(). """ # pylint: disable=W0621 from soc.modules.gci.logic.models.work_submission import logic as \ gci_work_submission_logic entity = self.getFromKeyFieldsOr404(fields) comment_entities = gci_comment_logic.getForFields( ancestors=[entity], order=['created_on']) ws_entities = gci_work_submission_logic.getForFields( ancestors=[entity], order=['submitted_on']) return entity, comment_entities, ws_entities