(self, state: InstanceState[Any], dict_: _InstanceDict)
| 1331 | __slots__ = () |
| 1332 | |
| 1333 | def delete(self, state: InstanceState[Any], dict_: _InstanceDict) -> None: |
| 1334 | if self.dispatch._active_history: |
| 1335 | old = self.get( |
| 1336 | state, |
| 1337 | dict_, |
| 1338 | passive=PASSIVE_ONLY_PERSISTENT |
| 1339 | | NO_AUTOFLUSH |
| 1340 | | LOAD_AGAINST_COMMITTED, |
| 1341 | ) |
| 1342 | else: |
| 1343 | old = self.get( |
| 1344 | state, |
| 1345 | dict_, |
| 1346 | passive=PASSIVE_NO_FETCH ^ INIT_OK |
| 1347 | | LOAD_AGAINST_COMMITTED |
| 1348 | | NO_RAISE, |
| 1349 | ) |
| 1350 | |
| 1351 | self.fire_remove_event(state, dict_, old, self._remove_token) |
| 1352 | |
| 1353 | existing = dict_.pop(self.key, NO_VALUE) |
| 1354 | |
| 1355 | # if the attribute is expired, we currently have no way to tell |
| 1356 | # that an object-attribute was expired vs. not loaded. So |
| 1357 | # for this test, we look to see if the object has a DB identity. |
| 1358 | if ( |
| 1359 | existing is NO_VALUE |
| 1360 | and old is not PASSIVE_NO_RESULT |
| 1361 | and state.key is None |
| 1362 | ): |
| 1363 | raise AttributeError("%s object does not have a value" % self) |
| 1364 | |
| 1365 | def get_history( |
| 1366 | self, |
nothing calls this directly
no test coverage detected