def get_game_by_owner_and_name(owner=None, game_name=None): """Get the game from db whose name is "game_name" and the owner is "owner" Args: :param owner: The owner of the game to obtain :type: User :param game_name: The name of the game to obtain :type: String """ if owner is None or owner.email is None or game_name is None: return None return Game.get_by_key_name(key_names=owner.email + "_" + game_name)
def exists_game(game_name=None, user=None): """Get a boolean value corresponding with the evidence of an existing game provided in db Args: :param game: The game to search in db :type: Game Returns: Boolean: Specify if the game is already stored in db """ if game_name is None or user is None: return False return Game.get_by_key_name(key_names=user.email + "_" + game_name) is not None