(state, item, initiator, **kw)
| 70 | return item |
| 71 | |
| 72 | def remove(state, item, initiator, **kw): |
| 73 | if item is None: |
| 74 | return |
| 75 | |
| 76 | sess = state.session |
| 77 | |
| 78 | prop = state.manager.mapper._props[key] |
| 79 | |
| 80 | if sess and sess._warn_on_events: |
| 81 | sess._flush_warning( |
| 82 | "collection remove" |
| 83 | if prop.uselist |
| 84 | else "related attribute delete" |
| 85 | ) |
| 86 | |
| 87 | if ( |
| 88 | item is not None |
| 89 | and item is not attributes.NEVER_SET |
| 90 | and item is not attributes.PASSIVE_NO_RESULT |
| 91 | and prop._cascade.delete_orphan |
| 92 | ): |
| 93 | # expunge pending orphans |
| 94 | item_state = attributes.instance_state(item) |
| 95 | |
| 96 | if prop.mapper._is_orphan(item_state): |
| 97 | if sess and item_state in sess._new: |
| 98 | sess.expunge(item) |
| 99 | else: |
| 100 | # the related item may or may not itself be in a |
| 101 | # Session, however the parent for which we are catching |
| 102 | # the event is not in a session, so memoize this on the |
| 103 | # item |
| 104 | item_state._orphaned_outside_of_session = True |
| 105 | |
| 106 | def set_(state, newvalue, oldvalue, initiator, **kw): |
| 107 | # process "save_update" cascade rules for when an instance |
nothing calls this directly
no test coverage detected