Exemplo n.º 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.')
Exemplo n.º 2
0
Arquivo: pur.py Projeto: Cloudef/PUR
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')
Exemplo n.º 3
0
Arquivo: pur.py Projeto: Cloudef/PUR
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')
Exemplo n.º 4
0
Arquivo: pur.py Projeto: Cloudef/PUR
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)
Exemplo n.º 5
0
def favicon():
    return static_file('favicon.ico', root='files')
Exemplo n.º 6
0
def favicon():
    return static_file('favicon.ico', root='files')
Exemplo n.º 7
0
def server_static(filepath):
    return static_file(filepath, root=config["paths"]["dir_assets"])
Exemplo n.º 8
0
def static_view( filename):
    return static_file( filename, root=STATIC_DIR)
Exemplo n.º 9
0
def server_assets(static_filename):
    """
    加载js、css、图片等资源
    """
    assets_path = "./assets"
    return static_file(filename=static_filename, root=assets_path)
Exemplo n.º 10
0
def static_serve(filepath):
    return static_file(filepath, root='staticfiles')
Exemplo n.º 11
0
def humans():
  return static_file('humans.txt', root='./static/')
Exemplo n.º 12
0
Arquivo: pur.py Projeto: Cloudef/PUR
def get_js(jsf=None):
    '''fetch js script'''
    return static_file(jsf, root='views/js')
Exemplo n.º 13
0
def send_static(filename):
    return static_file(filename, root='./core/webserver')
Exemplo n.º 14
0
def static(path):
    return static_file(path, root=get_script_rel_path("static"))
Exemplo n.º 15
0
def asset(filename):
    return static_file(filename, root='./assets/')
Exemplo n.º 16
0
def static(filename):
    return static_file(filename,STATIC_PATH)
Exemplo n.º 17
0
def send_static(filename):
    return static_file(filename, root='./core/webserver')
Exemplo n.º 18
0
def server_static(filename):
    return static_file(filename,
                       root=os.path.join(CUCKOO_ROOT, "data", "html"))
Exemplo n.º 19
0
Arquivo: pur.py Projeto: Cloudef/PUR
def get_css(css=None):
    '''fetch css'''
    return static_file(css, root='views/css')
Exemplo n.º 20
0
def static(filename):
    return static_file(filename, root='./static/')
Exemplo n.º 21
0
def static_serve(filepath):
    return static_file(filepath, root='staticfiles')
Exemplo n.º 22
0
def send_static(filename):
  return static_file(filename, root='./static/')
Exemplo n.º 23
0
def pgp_publick_key():
    return static_file('pgp.txt', root='files')
Exemplo n.º 24
0
def pgp_publick_key():
    return static_file('pgp.txt', root='files')
Exemplo n.º 25
0
def web_client_sammy(filepath):
    return static_file(filepath, root='web/clients/sammy')
Exemplo n.º 26
0
def serve_static(filename):
    return static_file(filename, root='src/IHM/img/')
Exemplo n.º 27
0
 def server_static(self, filename):
     return static_file(filename, root='./static')
Exemplo n.º 28
0
def display_home():
    auth_required()
    return static_file('index.html', root='./')
Exemplo n.º 29
0
def send_static(filename):
    return static_file(filename, root='C:/Users/runar/projects/pi/camera')
Exemplo n.º 30
0
def static(filepath):
    return static_file(filepath, root='web')
Exemplo n.º 31
0
def get_platform_icon(bfile=None):
    '''get platform icon'''
    return static_file(bfile, root='media/platform/')
Exemplo n.º 32
0
def index():
    return static_file('index.html', root='web')
Exemplo n.º 33
0
def get_favicon():
    '''fetch favicon'''
    return static_file('favicon.ico', root='.')
Exemplo n.º 34
0
def server_static(filepath):
    return static_file(filepath, root='files')
Exemplo n.º 35
0
def help():
    static_file('help.html', root='.')
Exemplo n.º 36
0
def server_static(filepath):
    return static_file(filepath, root='files')
Exemplo n.º 37
0
def static(filename):
    return static_file(filename, root='static')
def display_home():
    return static_file('index.html', root='./')
Exemplo n.º 39
0
def server_static(filename):
    return static_file(filename, root=os.path.join(CUCKOO_ROOT, "data", "html"))
Exemplo n.º 40
0
def index():
    return static_file("index.html", root='./static/')
Exemplo n.º 41
0
def process(filepath):
    return bottle.static_file(filepath, root="static")
Exemplo n.º 42
0
def graph():
  return static_file('customgraph.html', root='./static/')
Exemplo n.º 43
0
def process():
    return bottle.static_file('index.html', root="static")
Exemplo n.º 44
0
def index():
  return static_file('home.html', root='./static/')
Exemplo n.º 45
0
def static(path):
    return static_file(path, root=get_script_rel_path("static"))
Exemplo n.º 46
0
def asset(filename):
  return static_file(filename, root='./assets/')
Exemplo n.º 47
0
def static(filepath):
    return static_file(filepath, root="./static")
Exemplo n.º 48
0
def display_home():
    return static_file('index.html', root='./')
Exemplo n.º 49
0
 def staticfiles(filename):
     return bottle.static_file(filename, root='data/theme/')