Beispiel #1
0
def get_build_file(project=None, branch=None, system=None, fsdate=None, bfile=None):
    '''get file for build'''
    validate_build(project, branch, system)

    ext = os.path.splitext(bfile)[1]
    path = os.path.join(SETTINGS['builds_directory'], project)
    path = os.path.join(path, branch)
    path = os.path.join(path, system)
    path = os.path.join(path, fsdate)

    if not os.path.exists(path):
        abort(404, "Build does not exist.")

    if bfile == 'build-status.png':
        response.set_header('Cache-control', 'no-cache')
        response.set_header('Pragma', 'no-cache')
        if not failure_for_build(project, branch, system, fsdate):
            return static_file('ok.png', root='media/status/')
        return static_file('fail.png', root='media/status/')
    elif ext == '.zip':
        return static_file(bfile, root=path)
    elif ext == '.bz2':
        return static_file(bfile, root=path)
    elif ext == '.txt':
        response.content_type = 'text/plain'
        path = os.path.join(path, bfile.replace('.txt', '.bz2'))
        if os.path.exists(path):
            return bz2.BZ2File(path).read()

    abort(404, 'No such file.')
Beispiel #2
0
def get_image(image=None, sub=None):
    '''fetch image'''
    if image == 'moe':
        import random
        image = random.choice(os.listdir('views/images/moe'))
        return static_file(image, root=('views/images/moe'))
    if sub:
        from os.path import join as path_join
        return static_file(image, root=path_join('views/images', sub))
    return static_file(image, root='views/images')
Beispiel #3
0
def get_recipe_revision_file(pkgname=None, revision=None, recipefile=None):
    '''fetch recipe revision file'''
    if revision:
        recipe = RECIPEMANAGER.get_revision(pkgname, revision)
    else:
        recipe = RECIPEMANAGER.get_recipe(pkgname)
    if not recipe:
        abort(404)
    path = os.path.join('userdata/recipes', recipe['pkgname'], recipe['directory'])
    if recipefile == 'PNDBUILD':
        if request.query.get('syntax'):
            data = None
            with open(os.path.join(path, recipefile), 'r') as fle:
                data = fle.read()
            if not data:
                abort(404, _('PNDBUILD file not found'))
            syntax = replace.syntax(data, 'bash')
            return syntax if is_ajax_request() else template('syntax', title='PNDBUILD', syntax=syntax)
        return static_file(recipefile, root=path, mimetype='text/plain')
    return static_file(recipefile, root=path, download=True, mimetype='application/octet-stream')
Beispiel #4
0
def recipes_page():
    '''recipes page'''
    if is_json_request():
        cachepath = 'userdata/cache/recipes.json'
        if not os.path.exists(cachepath) or os.path.getmtime(cachepath) < RECIPEMANAGER.modified():
            with open(cachepath, 'w') as fle:
                import json
                recipes = RECIPEMANAGER.query_recipes('ORDER BY pkgname')
                fle.write(json.dumps(recipes))
        return static_file('recipes.json', 'userdata/cache')
    results, matches, pages, options = search(RECIPEMANAGER.query_recipes, RECIPEMANAGER.query_recipes_count)
    return template('results', title=_('Recipes'), user=None, results=results, pages=pages, matches=matches, options=options)
Beispiel #5
0
def favicon():
    return static_file('favicon.ico', root='files')
Beispiel #6
0
def favicon():
    return static_file('favicon.ico', root='files')
def server_static(filepath):
    return static_file(filepath, root=config["paths"]["dir_assets"])
Beispiel #8
0
def static_view( filename):
    return static_file( filename, root=STATIC_DIR)
Beispiel #9
0
def server_assets(static_filename):
    """
    加载js、css、图片等资源
    """
    assets_path = "./assets"
    return static_file(filename=static_filename, root=assets_path)
Beispiel #10
0
def static_serve(filepath):
    return static_file(filepath, root='staticfiles')
Beispiel #11
0
def humans():
  return static_file('humans.txt', root='./static/')
Beispiel #12
0
def get_js(jsf=None):
    '''fetch js script'''
    return static_file(jsf, root='views/js')
Beispiel #13
0
def send_static(filename):
    return static_file(filename, root='./core/webserver')
Beispiel #14
0
def static(path):
    return static_file(path, root=get_script_rel_path("static"))
Beispiel #15
0
def asset(filename):
    return static_file(filename, root='./assets/')
Beispiel #16
0
def static(filename):
    return static_file(filename,STATIC_PATH)
Beispiel #17
0
def send_static(filename):
    return static_file(filename, root='./core/webserver')
Beispiel #18
0
def server_static(filename):
    return static_file(filename,
                       root=os.path.join(CUCKOO_ROOT, "data", "html"))
Beispiel #19
0
def get_css(css=None):
    '''fetch css'''
    return static_file(css, root='views/css')
Beispiel #20
0
def static(filename):
    return static_file(filename, root='./static/')
Beispiel #21
0
def static_serve(filepath):
    return static_file(filepath, root='staticfiles')
Beispiel #22
0
def send_static(filename):
  return static_file(filename, root='./static/')
Beispiel #23
0
def pgp_publick_key():
    return static_file('pgp.txt', root='files')
Beispiel #24
0
def pgp_publick_key():
    return static_file('pgp.txt', root='files')
Beispiel #25
0
def web_client_sammy(filepath):
    return static_file(filepath, root='web/clients/sammy')
def serve_static(filename):
    return static_file(filename, root='src/IHM/img/')
Beispiel #27
0
 def server_static(self, filename):
     return static_file(filename, root='./static')
Beispiel #28
0
def display_home():
    auth_required()
    return static_file('index.html', root='./')
Beispiel #29
0
def send_static(filename):
    return static_file(filename, root='C:/Users/runar/projects/pi/camera')
Beispiel #30
0
def static(filepath):
    return static_file(filepath, root='web')
Beispiel #31
0
def get_platform_icon(bfile=None):
    '''get platform icon'''
    return static_file(bfile, root='media/platform/')
Beispiel #32
0
def index():
    return static_file('index.html', root='web')
Beispiel #33
0
def get_favicon():
    '''fetch favicon'''
    return static_file('favicon.ico', root='.')
Beispiel #34
0
def server_static(filepath):
    return static_file(filepath, root='files')
Beispiel #35
0
def help():
    static_file('help.html', root='.')
Beispiel #36
0
def server_static(filepath):
    return static_file(filepath, root='files')
Beispiel #37
0
def static(filename):
    return static_file(filename, root='static')
def display_home():
    return static_file('index.html', root='./')
Beispiel #39
0
def server_static(filename):
    return static_file(filename, root=os.path.join(CUCKOO_ROOT, "data", "html"))
Beispiel #40
0
def index():
    return static_file("index.html", root='./static/')
Beispiel #41
0
def process(filepath):
    return bottle.static_file(filepath, root="static")
Beispiel #42
0
def graph():
  return static_file('customgraph.html', root='./static/')
Beispiel #43
0
def process():
    return bottle.static_file('index.html', root="static")
Beispiel #44
0
def index():
  return static_file('home.html', root='./static/')
Beispiel #45
0
def static(path):
    return static_file(path, root=get_script_rel_path("static"))
Beispiel #46
0
def asset(filename):
  return static_file(filename, root='./assets/')
Beispiel #47
0
def static(filepath):
    return static_file(filepath, root="./static")
Beispiel #48
0
def display_home():
    return static_file('index.html', root='./')
Beispiel #49
0
 def staticfiles(filename):
     return bottle.static_file(filename, root='data/theme/')