Example #1
0
def check_validity_input_formats(input_formats):
    """Check the validity of every input format.

    @param input_formats: list of given formats
    @type input_formats: list
    @return: if there is any invalid input format it returns this value
    @rtype: string
    """
    from invenio.search_engine import get_available_output_formats
    valid_formats = get_available_output_formats()

    # let's to extract the values of the available formats
    format_values = []
    for aformat in valid_formats:
        format_values.append(aformat['value'])

    invalid_format = ''
    for aformat in input_formats:
        if aformat.lower() not in format_values:
            invalid_format = aformat.lower()
            break
    return invalid_format
Example #2
0
def check_validity_input_formats(input_formats):
    """
    Checks the validity of every input format.
    @param input_formats: list of given formats
    @type input_formats: list
    @return: if there is any invalid input format it returns this value
    @rtype: string
    """
    from invenio.search_engine import get_available_output_formats
    valid_formats = get_available_output_formats()

    # let's to extract the values of the available formats
    format_values = []
    for aformat in valid_formats:
        format_values.append(aformat['value'])

    invalid_format = ''
    for aformat in input_formats:
        if aformat.lower() not in format_values:
            invalid_format = aformat.lower()
            break
    return invalid_format