@dir_app.route('/results/')
def get_result_dir_info():
    dir_info = []

    try:
        dir_listing = os.listdir(WORK_DIR)
    except OSError:
        # The WORK_DIR hasn't been created, so we don't have any results!
        pass
    else:
        for obj in dir_listing:
            # Ignore hidden files
            if obj[0] == '.': continue

            # Create a path to the listed object and strip the work dir leader.
            # If the result isn't a directory, ignore it.
            obj = os.path.join(WORK_DIR, obj)
            if not os.path.isdir(obj): continue
            dir_info.append(obj.replace(WORK_DIR, ''))

        sorted(dir_info, key=lambda s: s.lower())

    if request.query.callback:
        return "%s(%s)" % (request.query.callback, {'listing': dir_info})
    return {'listing': dir_info}
Retrieve results directory information.
dataset/ETHPy150Open apache/climate/ocw-ui/backend/directory_helpers.py/get_result_dir_info