Change Sets

Change sets represent a transition from one state of a model to another. There is no change set base class, rather change sets are a collection of attributes representing the state change.

However, there are several assisting classes around them.

Interfaces

class flaskbb.core.changesets.ChangeSetHandler[source]

Used to apply a changeset to a model.

apply_changeset(model, changeset)[source]

Receives the current model and the changeset object, apply the changeset to the model and persist the model. May raise a StopValidation if the changeset could not be applied.

class flaskbb.core.changesets.ChangeSetValidator[source]

Used to validate a change set is valid to apply against a model

validate(model, changeset)[source]

May raise a ValidationError to signify that the changeset cannot be applied to the model. Or a StopValidation to immediately halt all validation.

class flaskbb.core.changesets.ChangeSetPostProcessor[source]

Used to handle actions after a change set has been persisted.

post_process_changeset(model, changeset)[source]

Used to react to a changeset’s application to a model.

Helpers

class flaskbb.core.changesets.EmptyValue[source]

Represents an empty change set value when None is a valid value to apply to the model.

This class is a singleton.

flaskbb.core.changesets.is_empty(value, consider_none=False)[source]

Helper to check if an arbitrary value is an EmptyValue