am sorry for asking this dumb question, but can i use this technique
(which is used in the examples of projects made by tornado users) to
make inheritence?
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
user = self.get_secure_cookie("current_user") or False
if not user: return None
return tornado.escape.json_decode(user)
@property
def db(self):
if not hasattr(BaseHandler,"_db"):
_db = pymongo.Connection().tuxhub
return _db
@property
def fs(self):
if not hasattr(BaseHandler,"_fs"):
_fs = gridfs.GridFS(self.db)
return _fs
it will work in the same maneer in Motor? because i've seen a
parameter:
application = tornado.web.Application([
(r'/', MainHandler)
], db=db)
if i use the first technique, then i will add the db=db ?