Exemple #1
0
def _do_auto_transition(context: IResource, registry: Registry):
    workflow = registry.content.get_workflow(context)
    next_states = workflow.get_next_states(context,
                                           create_fake_god_request(registry))
    print('Auto-transition of {} workflow to state {}.'
          .format(context, next_states))
    transition_to_states(context, next_states, registry)
def _set_workflow_state(
    root: IResource, registry: Registry, resource_path: str, states: [str], absolute=False, reset=False
):
    resource = find_resource(root, resource_path)
    states_to_transition = _get_states_to_transition(resource, registry, states, absolute, reset)
    transition_to_states(resource, states_to_transition, registry, reset=reset)
    transaction.commit()
Exemple #3
0
def initialize_workflow(context: IPool, registry: Registry, options: dict):
    """Initialize mercator workflow."""
    root = context
    # at this point the permissions are not setup so we need to add
    # the god's permissions
    root.__acl__ = [(Allow, 'role:god', ALL_PERMISSIONS)]
    mercator_process = root['mercator']
    transition_to_states(mercator_process, ['announce', 'participate'], registry)
Exemple #4
0
def initialize_workflow(context: IPool, registry: Registry, options: dict):
    """Initialize mercator workflow."""
    root = context
    # at this point the permissions are not setup so we need to add
    # the god's permissions
    root.__acl__ = [(Allow, 'role:god', ALL_PERMISSIONS)]
    mercator_process = root['mercator']
    transition_to_states(mercator_process, ['announce', 'participate'],
                         registry)
Exemple #5
0
def _set_workflow_state(
    root: IResource,
    registry: Registry,
    resource_path: str,
    states: [str],
    absolute=False,
    reset=False,
):
    resource = find_resource(root, resource_path)
    states_to_transition = _get_states_to_transition(resource, registry,
                                                     states, absolute, reset)
    transition_to_states(resource, states_to_transition, registry, reset=reset)
    transaction.commit()
def set_workflow_state(root: IResource,
                       registry: Registry,
                       resource_path: str,
                       states: [str],
                       absolute=False,
                       reset=False,
                       ):
    """Set a workflow state for a given resource."""
    resource = find_resource(root, resource_path)
    states_to_transition = _get_states_to_transition(resource,
                                                     registry,
                                                     states,
                                                     absolute,
                                                     reset)
    transition_to_states(resource,
                         states_to_transition,
                         registry,
                         reset=reset)
    transaction.commit()