Welcome to yawf’s documentation!¶
Contents:
yawf Package¶
actions
Module¶
annotation
Module¶
base
Module¶
base_model
Module¶
config
Module¶
creation
Module¶
dispatch
Module¶
effects
Module¶
-
class
yawf.effects.
SideEffect
(message_id=None, states_from=None, states_to=None, message_group=None)[source]¶ Bases:
object
Basic class to express side-effect actions.
SideEffect in yawf is a side-effect action that can be performed after certain changes in workflow.
User can treat effects as event handlers and put that handlers on any transition. To specify a transition, one can specify a list of states before transition, a list of states after transition and a list of message ids. Everything above is optional, so if you register a default side-effect without specify any of this variables, such side-effect will be called after each transition.
User can put any number of side-effects on each and every transition. In case of multiple effects matching specific transition each side-effect will be executed one by one.
Yawf executes side-effect after state transition, when yawf obtains new state (and possibly modified object).
- Yawf passes keyword arguments to side-effect:
old_obj: the object before the state transition (before locking);
obj: the object after the state transition;
sender: message sender;
params: message arguments;
- message_spec: message spec class (because we may want to distinguish
between different messages in effects);
- extra_context: extra context thas was passed to
yawf.dispatch.dispatch()
;
handler_result: result of the state transition routine.
-
is_transactional
= False¶
-
message_group
= None¶
-
message_id
= None¶
-
name
¶
-
states_from
= None¶
-
states_to
= None¶
exceptions
Module¶
-
exception
yawf.exceptions.
ConcurrentRevisionUpdate
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'concurrent_revision_update'¶
-
-
exception
yawf.exceptions.
CreateValidationError
(validator)[source]¶ Bases:
yawf.exceptions.MessageValidationError
-
code
= 'create_validation_error'¶
-
-
exception
yawf.exceptions.
GroupPathEmptyError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'group_path_empty_error'¶
-
-
exception
yawf.exceptions.
IllegalStateError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'illegal_state_error'¶
-
-
exception
yawf.exceptions.
MessageIgnored
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'message_ignored'¶
-
context
¶
-
-
exception
yawf.exceptions.
MessageSpecNotRegisteredError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'message_spec_not_registered_error'¶
-
-
exception
yawf.exceptions.
MessageValidationError
(validator)[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'yawf_validation_error'¶
-
context
¶
-
-
exception
yawf.exceptions.
NoAvailableMessagesError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'no_available_messages_error'¶
-
-
exception
yawf.exceptions.
OldStateInconsistenceError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'old_state_inconsistence_error'¶
-
-
exception
yawf.exceptions.
PermissionDeniedError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'permission_denied_error'¶
-
-
exception
yawf.exceptions.
ResourceNotFoundError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'resource_not_found_error'¶
-
-
exception
yawf.exceptions.
ResourcePermissionDeniedError
[source]¶ Bases:
yawf.exceptions.PermissionDeniedError
-
code
= 'resource_permission_denied_error'¶
-
-
exception
yawf.exceptions.
UnhandledMessageError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'unhandled_message_error'¶
-
context
¶
-
-
exception
yawf.exceptions.
WorkflowAlreadyRegisteredError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'workflow_already_registered_error'¶
-
-
exception
yawf.exceptions.
WorkflowNotLoadedError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'workflow_not_loaded_error'¶
-
-
exception
yawf.exceptions.
WrongHandlerResultError
[source]¶ Bases:
yawf.exceptions.YawfException
-
code
= 'wrong_handler_result_error'¶
-
forms
Module¶
graph
Module¶
graph_views
Module¶
handlers
Module¶
-
class
yawf.handlers.
Handler
(message_id=None, states_from=None, message_group=None, permission_checker=None)[source]¶ Bases:
object
Basic class to express state transitions, both simple and extended.
Handler object is a callable. It gets a workflow object, message sender and arbitrary keyword arguments (passed with message) and must return new state id based on this information (it can return None and message will be ignored).
If handler returns a callable, then this callable applies as transaction on object (to change its extended state). The result of the latter callable represents a transition result. If callable returns generator, transition routine will iterate over it, collecting the yielded values. For more information about state transition, see
yawf.state_transition
module.Transitioning callable can actually return anything besides generator. That is totally an application designer business.
-
copy_before_call
= False¶
-
defer
= True¶
-
message_group
= None¶
-
message_id
= None¶
-
permission_checker
= None¶
-
replace_if_exists
= False¶
-
states_from
= None¶
-
-
class
yawf.handlers.
SimpleStateTransition
(*args, **kwargs)[source]¶ Bases:
yawf.handlers.Handler
-
state_to
= None¶
-
-
class
yawf.handlers.
ComplexStateTransition
(message_id=None, states_from=None, message_group=None, permission_checker=None)[source]¶ Bases:
yawf.handlers.Handler
-
class
yawf.handlers.
EditHandler
(message_id=None, states_from=None, message_group=None, permission_checker=None)[source]¶ Bases:
yawf.handlers.ComplexStateTransition
-
field_names
= None¶
-
library
Module¶
models
Module¶
permissions
Module¶
-
yawf.permissions.
C
¶ alias of
AndChecker
serialize_utils
Module¶
signals
Module¶
state_transition
Module¶
utils
Module¶
version
Module¶
views
Module¶
Subpackages¶
management Package¶
messages Package¶
messages
Package¶
allowed
Module¶
common
Module¶
-
class
yawf.messages.common.
BasicCancelMessage
(**attrs)[source]¶ Bases:
yawf.messages.spec.MessageSpec
-
id
= 'cancel'¶
-
rank
= 1000¶
-
verb
= <django.utils.functional.__proxy__ object>¶
-
-
class
yawf.messages.common.
BasicDeleteMessage
(**attrs)[source]¶ Bases:
yawf.messages.spec.MessageSpec
-
id
= 'delete'¶
-
rank
= 1001¶
-
verb
= <django.utils.functional.__proxy__ object>¶
-
-
class
yawf.messages.common.
BasicEditMessage
(**attrs)[source]¶ Bases:
yawf.messages.spec.MessageSpec
-
id
= 'edit'¶
-
rank
= 900¶
-
verb
= <django.utils.functional.__proxy__ object>¶
-
-
class
yawf.messages.common.
BasicStartMessage
(**attrs)[source]¶ Bases:
yawf.messages.spec.MessageSpec
-
id
= 'start_workflow'¶
-
verb
= <django.utils.functional.__proxy__ object>¶
-
spec
Module¶
-
class
yawf.messages.spec.
EmptyValidator
(*args, **kwargs)[source]¶ Bases:
object
Class with django-form behaviour that filters out all incoming data, always becomes valid and returns empty dict as cleaned data.
-
cleaned_data
¶
-
-
class
yawf.messages.spec.
MessageSpec
(**attrs)[source]¶ Bases:
object
Specifies a message that can be passed to workflow.
Basic class for one of main entities. Message spec knows:
-
dehydrate_params
(obj, message)[source]¶ Method, that returns dehydrated message params for serialization.
-
id
= None¶
-
id_grouper
= '__'¶
-
is_grouped
= False¶
-
params_wrapper
(params)[source]¶ Wrapper used to wrap cleaned_data returned by validator_cls before passing it to handler.
With wrapper one has additional layer to transform structure of cleaned_data dict to make it more convenient to use.
For example, see yawf.messages.common.BasicEditMessage class.
-
rank
= 0¶
-
validator_cls
¶ alias of
EmptyValidator
-
verb
= None¶
-