def connect(self):
"""????"""
try:
self.recorder('INFO', '{obj} connect start'.format(obj=self))
self.set_idle()
self._client = motor_tornado.MotorClient(**self.setting)
if self.db:
self.select_db(self.db)
self.isConnect = True
self.recorder('INFO', '{obj} connect successful'.format(obj=self))
except ConnectionFailure as e:
self.recorder('ERROR', '{obj} connect failed [{msg}]'.format(obj=self, msg=e))
self.error()
raise MongoError
raise Return(self)
评论列表
文章目录