Function | snapshot_sql_result | Snapshot adapter for the Storm result set. |
Function | notify_modified | A context manager that notifies about modifications to an object. |
A context manager that notifies about modifications to an object.
Use this as follows:
with notify_modified(obj, ["attr"]): obj.attr = value
Or:
edited_fields = set() with notify_modified(obj, edited_fields): if obj.attr != new_attr: obj.attr = new_attr edited_fields.add("attr")
Or even:
edited_fields = set() with notify_modified(obj, edited_fields) as previous_obj: do_something() if obj.attr != previous_obj.attr: edited_fields.add("attr")
Parameters | obj | The object being modified. |
edited_fields | An iterable of fields being modified. This is not
used until after the block wrapped by the context manager has
finished executing, so you can safely pass a mutable object and add
items to it from inside the block as you determine which fields are
being modified. A notification will only be sent if edited_fields
is non-empty. | |
snapshot_names | If not None, only snapshot these names. This may
be used if snapshotting some of the object's attributes is expensive
in some contexts (and they can't be wrapped by doNotSnapshot for
some reason). | |
user | If not None, the user making these changes. If None, defaults to the principal registered in the current interaction. |