mrs_plugin/content_files.py
def format_content_file_listing(content_files, print_header=True):
    """Formats the listing of content files

    Args:
        content_files (list): A list of content files as dicts
        print_header (bool): If set to true, a header is printed


    Returns:
        The formated list of services
    """

    if print_header:
        output = (f"{'ID':>3} {'PATH':65} {'ENABLED':7} {'AUTH':4} "
                  f"{'LAST META CHANGE':16} {'SIZE':9}\n")
    else:
        output = ""

    i = 0
    for item in content_files:
        i += 1
        path = (item['host_ctx'] + item['content_set_request_path'] +
                item['request_path'])
        changed_at = str(item['changed_at']) if item['changed_at'] else ""
        file_size = sizeof_fmt(item['size'])

        output += (f"{item['id']:>3} {path[:65]:65} "
                   f"{'Yes' if item['enabled'] else '-':7} "
                   f"{'Yes' if item['requires_auth'] else '-':4} "
                   f"{changed_at[:16]:16} {file_size[:9]:>9}")
        if i < len(content_files):
            output += "\n"

    return output
Formats the listing of content files

    Args:
        content_files (list): A list of content files as dicts
        print_header (bool): If set to true, a header is printed


    Returns:
        The formated list of services
    
Formats the listing of content files
Formats the listing of content files
def format_content_file_listing(content_files, print_header=True):
    if print_header:
        output = (f"{'ID':>3} {'PATH':65} {'ENABLED':7} {'AUTH':4} "
                  f"{'LAST META CHANGE':16} {'SIZE':9}\n")
    else:
        output = ""
    i = 0
    for item in content_files:
        i += 1
        path = (item['host_ctx'] + item['content_set_request_path'] +
                item['request_path'])
        changed_at = str(item['changed_at']) if item['changed_at'] else ""
        file_size = sizeof_fmt(item['size'])
        output += (f"{item['id']:>3} {path[:65]:65} "
                   f"{'Yes' if item['enabled'] else '-':7} "
                   f"{'Yes' if item['requires_auth'] else '-':4} "
                   f"{changed_at[:16]:16} {file_size[:9]:>9}")
        if i < len(content_files):
            output += "\n"
    return output
def format_content_file_listing ( content_files , print_header = True ) : if print_header : output = ( f"{'ID':>3} {'PATH':65} {'ENABLED':7} {'AUTH':4} " f"{'LAST META CHANGE':16} {'SIZE':9}\n" ) else : output = "" i = 0 for item in content_files : i += 1 path = ( item [ 'host_ctx' ] + item [ 'content_set_request_path' ] + item [ 'request_path' ] ) changed_at = str ( item [ 'changed_at' ] ) if item [ 'changed_at' ] else "" file_size = sizeof_fmt ( item [ 'size' ] ) output += ( f"{item['id']:>3} {path[:65]:65} " f"{'Yes' if item['enabled'] else '-':7} " f"{'Yes' if item['requires_auth'] else '-':4} " f"{changed_at[:16]:16} {file_size[:9]:>9}" ) if i < len ( content_files ) : output += "\n" return output
Formats the listing of content files
Formats the listing of content files
"""Formats the listing of content files

    Args:
        content_files (list): A list of content files as dicts
        print_header (bool): If set to true, a header is printed


    Returns:
        The formated list of services
    """
The formated list of services
The formated list of services
content_files
A list of content files as dicts
A list of content files as dicts
print_header
If set to true, a header is printed
If set to true a header is printed