(self, state: InstanceState[Any], dict_: _InstanceDict)
| 1352 | __slots__ = () |
| 1353 | |
| 1354 | def delete(self, state: InstanceState[Any], dict_: _InstanceDict) -> None: |
| 1355 | if self.dispatch._active_history: |
| 1356 | old = self.get( |
| 1357 | state, |
| 1358 | dict_, |
| 1359 | passive=PASSIVE_ONLY_PERSISTENT |
| 1360 | | NO_AUTOFLUSH |
| 1361 | | LOAD_AGAINST_COMMITTED, |
| 1362 | ) |
| 1363 | else: |
| 1364 | old = self.get( |
| 1365 | state, |
| 1366 | dict_, |
| 1367 | passive=PASSIVE_NO_FETCH ^ INIT_OK |
| 1368 | | LOAD_AGAINST_COMMITTED |
| 1369 | | NO_RAISE, |
| 1370 | ) |
| 1371 | |
| 1372 | self.fire_remove_event(state, dict_, old, self._remove_token) |
| 1373 | |
| 1374 | existing = dict_.pop(self.key, NO_VALUE) |
| 1375 | |
| 1376 | # if the attribute is expired, we currently have no way to tell |
| 1377 | # that an object-attribute was expired vs. not loaded. So |
| 1378 | # for this test, we look to see if the object has a DB identity. |
| 1379 | if ( |
| 1380 | existing is NO_VALUE |
| 1381 | and old is not PASSIVE_NO_RESULT |
| 1382 | and state.key is None |
| 1383 | ): |
| 1384 | raise AttributeError("%s object does not have a value" % self) |
| 1385 | |
| 1386 | def get_history( |
| 1387 | self, |
nothing calls this directly
no test coverage detected