简体   繁体   中英

Wrap value in twisted deferred

There is function which must return a deferred object, but I get a value synchronously.

Now I am returning that value with inlineCallbacks decorator:

@defer.inlineCallbacks
def collect(self, config):
    yield
    data = new_data() # synchronous call
    defer.returnValue(data)

But may be there is some function which wraps value in deferred object, which than is immediately called?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM