-
-
Save minrk/963483 to your computer and use it in GitHub Desktop.
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
# override ioloop.IOLoop with zmq's IOLoop | |
import sys | |
import tornado.ioloop | |
from zmq.eventloop import ioloop | |
tornado.ioloop.IOLoop = ioloop.IOLoop | |
import trombi | |
loop = ioloop.IOLoop.instance() | |
# check that tornado's ioloop instance is actually zmq's | |
assert loop is sys.modules['tornado.ioloop'].IOLoop.instance(), 'IOLoop override failed' | |
f = open('onemb.zero') | |
db = trombi.from_uri('http://localhost:5984/test') | |
def doc_created(doc): | |
assert not doc.error | |
doc.attach('1M', f.read(), attach_done) | |
def attach_done(doc): | |
print 'attach_done' | |
assert not doc.error | |
loop.stop() | |
db.set({'test': 'doc'}, doc_created) | |
loop.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment