(self, state: InstanceState[Any], obj: object)
| 4268 | self._after_attach(state, obj) |
| 4269 | |
| 4270 | def _before_attach(self, state: InstanceState[Any], obj: object) -> bool: |
| 4271 | self._autobegin_t() |
| 4272 | |
| 4273 | if state.session_id == self.hash_key: |
| 4274 | return False |
| 4275 | |
| 4276 | if state.session_id and state.session_id in _sessions: |
| 4277 | raise sa_exc.InvalidRequestError( |
| 4278 | "Object '%s' is already attached to session '%s' " |
| 4279 | "(this is '%s')" |
| 4280 | % (state_str(state), state.session_id, self.hash_key) |
| 4281 | ) |
| 4282 | |
| 4283 | self.dispatch.before_attach(self, state) |
| 4284 | |
| 4285 | return True |
| 4286 | |
| 4287 | def _after_attach(self, state: InstanceState[Any], obj: object) -> None: |
| 4288 | state.session_id = self.hash_key |
no test coverage detected