ways.base.commander module

A set of classes and functions used to extend a Context’s interface.

Action objects attach to Contexts and let you change data on the Context or to run any kind of function.

ways.base.commander.Action

alias of _Aktion

class ways.base.commander.ActionRegistry[source]

Bases: type

A metaclass that adds new Action objects to a registry-cache.

ways.base.commander.add_action(action, name='', context='', assignment='master')[source]

Add a created action to this cache.

Parameters:
  • action (ways.api.Action) – The action to add. Action objects are objects that get passed a Context object and run a function.
  • name (str, optional) – A name to use with this action. The name must be unique to this hierarchy/assignment or it risks overriding another Action that might already exist at the same location. If no name is given, the name on the action is tried, instead.
  • context (ways.api.Context or str) – The Context or hierarchy of a Context to add this Action to.
  • assignment (str, optional) – The group to add this action to, Default: ‘master’.
Raises:
  • RuntimeError – If no hierarchy is given and no hierarchy could be found on the given action.
  • RuntimeError – If no name is given and no name could be found on the given action.