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

ProcessManager.bind_state_fields doesn't work with multiple states #29

Closed
khamenman opened this issue Jan 12, 2020 · 0 comments
Closed
Assignees

Comments

@khamenman
Copy link
Contributor

Currently there is a bug with ProcessManager.bind_state_fields method as it utilizes closures incorrectly:

for state_field, process_class in kwargs.items():
    if not issubclass(process_class, Process):
        raise TypeError('Must be a sub class of Process')
    parameters[process_class.get_process_name()] = property(lambda self: process_class(
        field_name=state_field,
        instance=self))
    parameters['state_fields'].append(state_field)

With this code, value of the process_class variable inside the lambda function will always be the last class passed in kwargs to bind_state_fields method.

khamenman added a commit to khamenman/django-logic that referenced this issue Jan 12, 2020
emil-balashov added a commit that referenced this issue Jan 13, 2020
@emil-balashov emil-balashov self-assigned this Jan 14, 2020
emil-balashov added a commit that referenced this issue Jan 14, 2020
#28 process name implementation and refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants