(self, uowcommit, states)
| 441 | ) |
| 442 | |
| 443 | def presort_deletes(self, uowcommit, states): |
| 444 | # head object is being deleted, and we manage its list of |
| 445 | # child objects the child objects have to have their |
| 446 | # foreign key to the parent set to NULL |
| 447 | should_null_fks = ( |
| 448 | not self.cascade.delete and not self.passive_deletes == "all" |
| 449 | ) |
| 450 | |
| 451 | for state in states: |
| 452 | history = uowcommit.get_attribute_history( |
| 453 | state, self.key, self._passive_delete_flag |
| 454 | ) |
| 455 | if history: |
| 456 | for child in history.deleted: |
| 457 | if child is not None and self.hasparent(child) is False: |
| 458 | if self.cascade.delete_orphan: |
| 459 | uowcommit.register_object(child, isdelete=True) |
| 460 | else: |
| 461 | uowcommit.register_object(child) |
| 462 | |
| 463 | if should_null_fks: |
| 464 | for child in history.unchanged: |
| 465 | if child is not None: |
| 466 | uowcommit.register_object( |
| 467 | child, operation="delete", prop=self.prop |
| 468 | ) |
| 469 | |
| 470 | def presort_saves(self, uowcommit, states): |
| 471 | children_added = uowcommit.memo(("children_added", self), set) |
no test coverage detected