Beispiel #1
0
    def get_user(self, username=None, user_id=None):
        """
        Wraps a `run_transaction` call that gets a User object. As a required function for LoginManager, the function must take the `user_id` argument, and return a User object.

        Keyword Arguments:
            username {String} -- The user's username. (default: {None})
            user_id {UUID} -- The user's unique ID. (default: {None})

        Returns:
            User -- A User object.
        """
        return run_transaction(
            sessionmaker(bind=self.engine),
            lambda session: get_user_txn(session, username, user_id))
Beispiel #2
0
    def get_user(self, email):
        """
        Wraps a `run_transaction` call that gets a User object.

        # NOTE: THE FOLLOWING MAY NEED TO GET MODIFIED:
        #     As a required function for LoginManager, the function must take
        #     the `user_id` argument, and return a User object.

        Keyword Arguments:
            email {String} -- The user's email. (default: {None})

        Returns:
            User -- A User dict.
        """
        return run_transaction(self.sessionfactory,
                               lambda session: get_user_txn(session, email))