def get_current_user(self):
        user_id = self.get_secure_cookie('user_id')
        if user_id != None:
            user = User.objects(id=user_id).first()
            
            if user != None:
                self.set_secure_cookie('user_id', user_id, expires_days=365)
            else:
                self.clear_cookie('user_id')
            return user
        else:
            return None
Loads user data from the DB if there's a user_id cookie defined.
dataset/ETHPy150Open tomekwojcik/iheartgit/iheartgit/handlers/__init__.py/BaseHandler.get_current_user