Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

Django Viewflow - Return Handler Response

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)?

question from:https://stackoverflow.com/questions/51653865/run-django-viewflow-update-node

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...