| 305 | self.presort_actions[key] = _Preprocess(processor, fromparent) |
| 306 | |
| 307 | def register_object( |
| 308 | self, |
| 309 | state: InstanceState[Any], |
| 310 | isdelete: bool = False, |
| 311 | listonly: bool = False, |
| 312 | cancel_delete: bool = False, |
| 313 | operation: Optional[str] = None, |
| 314 | prop: Optional[MapperProperty] = None, |
| 315 | ) -> bool: |
| 316 | if not self.session._contains_state(state): |
| 317 | # this condition is normal when objects are registered |
| 318 | # as part of a relationship cascade operation. it should |
| 319 | # not occur for the top-level register from Session.flush(). |
| 320 | if not state.deleted and operation is not None: |
| 321 | util.warn( |
| 322 | "Object of type %s not in session, %s operation " |
| 323 | "along '%s' will not proceed" |
| 324 | % (orm_util.state_class_str(state), operation, prop) |
| 325 | ) |
| 326 | return False |
| 327 | |
| 328 | if state not in self.states: |
| 329 | mapper = state.manager.mapper |
| 330 | |
| 331 | if mapper not in self.mappers: |
| 332 | self._per_mapper_flush_actions(mapper) |
| 333 | |
| 334 | self.mappers[mapper].add(state) |
| 335 | self.states[state] = (isdelete, listonly) |
| 336 | else: |
| 337 | if not listonly and (isdelete or cancel_delete): |
| 338 | self.states[state] = (isdelete, False) |
| 339 | return True |
| 340 | |
| 341 | def register_post_update(self, state, post_update_cols): |
| 342 | mapper = state.manager.mapper.base_mapper |