Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow overhaul #11

Merged
merged 6 commits into from
Sep 8, 2016
Merged

Workflow overhaul #11

merged 6 commits into from
Sep 8, 2016

Conversation

jsbueno
Copy link
Contributor

@jsbueno jsbueno commented Sep 6, 2016

Joao S. O. Bueno added 6 commits September 6, 2016 17:16
Permission decorator helps to separate logic for
various dynamic permissions in a given workflow,
 each in its own function.

Prior to that one had to override `permissions`
in a Workflow and bundle all permission logic in
it
Most notably, got rid of the previous verions of  'attached state'
which made a copy of the Workflowstate object and put in a reference
to a workflow instance in the copy.

This version uses descriptors, and a simple proxy object instead.

For the users of workflows, a new way to declare transitions
that don't require any code is simply declaring

class BlaWorkflow(Workflow):
    state1 = WorkflowState(...)
    my_transition = state1.transition(...)

And voilá - my_transition is a callable that will
make the state transition.
Just pass an 'extra_states' parameter when calling WorkflowState.transition
using decorator syntax -
like in:

class MyWorkflow(...):
    state1 = WorkflowState(...)
    state2 = ...
    aprove = state1.transiction(state2)

    @aprove.set_permission
    def can_approve(self):
         ...
@jsbueno jsbueno added this to the 0.1.0 milestone Sep 6, 2016
@rudaporto rudaporto modified the milestones: 1.1, 0.1.0 Sep 7, 2016
@ericof
Copy link
Member

ericof commented Sep 7, 2016

👍

@ericof ericof modified the milestone: 1.1 Sep 7, 2016
@ericof ericof merged commit faad46e into develop Sep 8, 2016
@rudaporto rudaporto deleted the workflow_overhaul branch September 15, 2016 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants