Browse Source

Support Motor 0.2

INADA Naoki 11 years ago
parent
commit
c814a3321b
1 changed files with 3 additions and 3 deletions
  1. 3 3
      tornado/server.py

+ 3 - 3
tornado/server.py

@@ -41,7 +41,7 @@ class PlaintextHandler(BaseHandler):
 class DBTestHandler(BaseHandler):
 class DBTestHandler(BaseHandler):
     @gen.coroutine
     @gen.coroutine
     def get(self):
     def get(self):
-        world = yield motor.Op(db.World.find_one, randint(1, 10000))
+        world = yield db.World.find_one(randint(1, 10000))
         # Get first postion on arguments, and so first postion in mongo return
         # Get first postion on arguments, and so first postion in mongo return
         world['id'] = str(world.pop('_id'))
         world['id'] = str(world.pop('_id'))
         response = json.dumps(world)
         response = json.dumps(world)
@@ -62,7 +62,7 @@ class QueryTestHandler(BaseHandler):
             elif queries > 500:
             elif queries > 500:
                 queries = 500
                 queries = 500
 
 
-        worlds = yield [motor.Op(db.World.find_one, randint(1, 10000))
+        worlds = yield [db.World.find_one(randint(1, 10000))
                         for _ in xrange(queries)]
                         for _ in xrange(queries)]
         for world in worlds:
         for world in worlds:
             # Get first postion on arguments, and so first postion in mongo return
             # Get first postion on arguments, and so first postion in mongo return
@@ -85,5 +85,5 @@ if __name__ == "__main__":
     server = tornado.httpserver.HTTPServer(application)
     server = tornado.httpserver.HTTPServer(application)
     server.bind(options.port)
     server.bind(options.port)
     server.start(0)
     server.start(0)
-    db = motor.MotorClient(options.mongo).open_sync().hello_world
+    db = motor.MotorClient(options.mongo).hello_world
     tornado.ioloop.IOLoop.instance().start()
     tornado.ioloop.IOLoop.instance().start()