Mark an attribute on an instance as 'modified'. This sets the 'modified' flag on the instance and establishes an unconditional change event for the given attribute. The attribute must have a value present, else an :class:`.InvalidRequestError` is raised. To mark an object "dirt
(instance: object, key: str)
| 2824 | |
| 2825 | |
| 2826 | def flag_modified(instance: object, key: str) -> None: |
| 2827 | class="st">"""Mark an attribute on an instance as &class="cm">#x27;modified'. |
| 2828 | |
| 2829 | This sets the &class="cm">#x27;modified' flag on the instance and |
| 2830 | establishes an unconditional change event for the given attribute. |
| 2831 | The attribute must have a value present, else an |
| 2832 | :class:`.InvalidRequestError` is raised. |
| 2833 | |
| 2834 | To mark an object class="st">"dirty" without referring to any specific attribute |
| 2835 | so that it is considered within a flush, use the |
| 2836 | :func:`.attributes.flag_dirty` call. |
| 2837 | |
| 2838 | .. seealso:: |
| 2839 | |
| 2840 | :func:`.attributes.flag_dirty` |
| 2841 | |
| 2842 | class="st">""" |
| 2843 | state, dict_ = instance_state(instance), instance_dict(instance) |
| 2844 | impl = state.manager[key].impl |
| 2845 | impl.dispatch.modified(state, impl._modified_token) |
| 2846 | state._modified_event(dict_, impl, NO_VALUE, is_userland=True) |
| 2847 | |
| 2848 | |
| 2849 | def flag_dirty(instance: object) -> None: |
no test coverage detected