Django Viewflow - Return Handler Response

£可爱£侵袭症+ 提交于 2019-12-25 04:13:34

问题


Following is my flow:-

class APLWorkflow(Flow):

    start = (
        flow.StartFunction(function1)
        .Next(this.request_quotes)
    )

    request_quotes = (
        flow.Handler(function2)
        .Next(this.move_package)
    )

    move_package = (
        flow.Handler(function3)
        .Next(this.shipment_create)
    )

    shipment_create = (
        flow.Function(function4)
        .Next(this.end)
    )

    end = flow.End()

Following are my util functions:-

def function1():
    return 1


def function2():
    return 2


def function3():
    return 3


def function4():
    return 4

The problem is when I start the flow, it runs perfectly well. However, the response returned is that of start node, not the last executed node.

Following is my code:-

activation.prepare()
response = APLWorkFLow.start.run(**some_kwargs)
activation.done() # stops the flow at `move_package`.    
print(response)  # prints 1, not 3.

How do I return the response of the last executed node, in this Handler (move_package)?

来源:https://stackoverflow.com/questions/51839068/django-viewflow-return-handler-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!