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

Calling the parent method for a transition #13

Open
bors-ltd opened this issue Apr 28, 2016 · 1 comment
Open

Calling the parent method for a transition #13

bors-ltd opened this issue Apr 28, 2016 · 1 comment

Comments

@bors-ltd
Copy link

Hi,

With the following use case:

class Parent(xworkflows.WorkflowEnabled):
    @xworkflows.transition()
    def accept(self):
        # Default behaviour


class Child(Parent):
    @xworkflows.transition()
    def accept(self):
        if child_condition:
            # Child behaviour

        return super(Child, self).accept()

child = Child()
child.accept()

If child_condition is not met, it calls the original accept method. But it leads to two "accept" transitions in the log, the second one being already from the "accepted" state, although it's not allowed by the workflow.

I found out I can access the undecorated Parent.accept method via return super(Child, self).accept.func().

The real issue happened on a Django model with django-xworkflows.

@bors-ltd
Copy link
Author

Actually with django-xworkflows, it was return super(Child, self).accept.implementation(self), as I faced a DjangoImplementationWrapper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant