Esempio n. 1
0
def stylesheets(filename):
    return static_file(filename, root='static/css')
Esempio n. 2
0
def picamera_takeshot(name = 0, x = 2592, y = 1980):
    if name != 0:
        photoname = application.capture(name, x, y)
        return static_file(photoname + '.jpg', root='img/', mimetype='image/png')
    else:
        return "Le nom doit etre specifie"
Esempio n. 3
0
def img(name = ''):
    if name != '':
        return static_file(name, root='img/', mimetype='image/png')
Esempio n. 4
0
def js_route():
    return static_file('script.js', root='./public/js')
def server_static(filepath):
    return static_file(filepath, root='public')
Esempio n. 6
0
def catch_all(path):
    # Return static files.
    if path in STATIC_FILES:
        mimetype = MIME_TYPES.get(Path(path).suffix, 'auto')
        return static_file(path, STATIC_DIR, mimetype=mimetype)

    # Parse path.
    run_dir, test_dir = parse_path(path)

    if run_dir and not test_dir:
        # Show run page.
        run = database.load_run(database.run_report_file(run_dir))
        if not run:
            return template('error',
                            message=f'Run "{run_dir}" does not exist.')

        nav = [{
            'title': 'Home',
            'link': '/'
        }, {
            'title': 'Run: ' + run_dir,
            'link': '/' + run_dir
        }]
        stats = run_stats(run)
        return template('run',
                        nav=nav,
                        tag_titles=TAG_TITLES,
                        stats=stats,
                        run_dir=run_dir,
                        run=run,
                        run_tags=database.run_tags,
                        format_date=format_date,
                        format_duration=format_duration)

    elif run_dir and test_dir:
        # Show test page.
        test = database.load_test(database.test_report_file(run_dir, test_dir))
        if not test:
            return template(
                'error',
                message=f'Test "{test_dir}" does not exist for run "{run_dir}".'
            )

        action = request.query.get('action', None)
        if action == 'compare':
            # Compare images.
            image = Path(request.query['image']).as_posix()
            result_image = Path('/result') / run_dir / test_dir / image
            error_image = Path(str(result_image) + config.ERROR_IMAGE_SUFFIX)
            ref_dir = Path(test['ref_dir']).relative_to(database.ref_dir)
            ref_image = Path('/ref') / ref_dir / image
            jeri_data = create_jeri_data(result_image, ref_image, error_image)
            return template('compare',
                            image=str(image),
                            jeri_data=json.dumps(jeri_data))
        else:
            nav = [{
                'title': 'Home',
                'link': '/'
            }, {
                'title': 'Run: ' + run_dir,
                'link': '/' + run_dir
            }, {
                'title': 'Test: ' + test_dir,
                'link': '/' + run_dir + '/' + test_dir
            }]
            stats = test_stats(test)
            ref_dir = str(
                Path(test['ref_dir']).relative_to(database.ref_dir).as_posix())
            return template('test',
                            nav=nav,
                            stats=stats,
                            run_dir=run_dir,
                            test_dir=test_dir,
                            ref_dir=ref_dir,
                            test=test,
                            format_duration=format_duration)
    else:
        return template('error', message='Invalid URL.')

    return str([run_dir, test_dir])
Esempio n. 7
0
def static(filename):
    return static_file(filename, root='static/')
Esempio n. 8
0
def serve_js(filename):
	return static_file(filename,root=ROOT_DIR + '/libs/js')	
Esempio n. 9
0
def serve_static(filename):
	return static_file(filename,root=ROOT_DIR)
Esempio n. 10
0
def home():
	return static_file('index.html',root=ROOT_DIR)
Esempio n. 11
0
def main_content():
	return static_file('main.html',root=ROOT_DIR)	
Esempio n. 12
0
def static(path):
    return static_file(path, root='static')
Esempio n. 13
0
def server_static(filepath):
    return static_file(filepath, root='./view') 
Esempio n. 14
0
def images(filename):
    return static_file(filename, root='static/img')
Esempio n. 15
0
def static(filepath):
    return static_file(filepath, root="./static/")
Esempio n. 16
0
def serve_less(filename):
	return static_file(filename,root=ROOT_DIR + '/less')
Esempio n. 17
0
def stylesheets(filename):
    return static_file(filename, root='static/css')
Esempio n. 18
0
def serve_font(filename):
	return static_file(filename,root=ROOT_DIR + '/fonts')
Esempio n. 19
0
def file_stac(filepath):
	return static_file(filepath,root="./static")
Esempio n. 20
0
def serve_img(filename):
	return static_file(filename,root=ROOT_DIR + '/img')
Esempio n. 21
0
def home():
    return static_file('index.html', root='./public', mimetype="text/html")
Esempio n. 22
0
def serve_static(filename):
    return static_file(filename, root="static")
def server_static(filename):
    return static_file(filename, root='public')
Esempio n. 24
0
def server_static(filename):
    return static_file(filename, root='./public_html')
Esempio n. 25
0
def server_static(filename):
    return static_file(filename, root='./public_html')
def server_static(filepath):
    return static_file(filepath, root='./public')
Esempio n. 27
0
def webapp(path = 0):
    if path == 0:
        path = 'index.html'
    return static_file(path, root='webapp/')
Esempio n. 28
0
def static_server(filename):
    return static_file(filename,root='static')
Esempio n. 29
0
def javascripts(filename):
    return static_file(filename, root='static/js')
Esempio n. 30
0
def test():
    return static_file('test.html',root='static')
Esempio n. 31
0
def images(filename):
    return static_file(filename, root='static/img')
Esempio n. 32
0
def result_image(path):
    return static_file(path, database.ref_dir)
Esempio n. 33
0
def cache_file(filepath):
    return static_file(filepath, root="./cache/")
Esempio n. 34
0
def javascripts(filename):
    return static_file(filename, root='static/js')