Created
September 30, 2011 14:23
-
-
Save phretor/1253883 to your computer and use it in GitHub Desktop.
Wrapping Twisted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Helper(object): | |
res = None | |
def search(self): | |
d = this_returns_a_deferred() | |
def _save(results): | |
self.res = results | |
d.addCallback(_save) | |
d.addBoth(lambda _: reactor.stop()) | |
reactor.run() | |
return self.res |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment