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.')
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')
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')
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)
def favicon(): return static_file('favicon.ico', root='files')
def server_static(filepath): return static_file(filepath, root=config["paths"]["dir_assets"])
def static_view( filename): return static_file( filename, root=STATIC_DIR)
def server_assets(static_filename): """ 加载js、css、图片等资源 """ assets_path = "./assets" return static_file(filename=static_filename, root=assets_path)
def static_serve(filepath): return static_file(filepath, root='staticfiles')
def humans(): return static_file('humans.txt', root='./static/')
def get_js(jsf=None): '''fetch js script''' return static_file(jsf, root='views/js')
def send_static(filename): return static_file(filename, root='./core/webserver')
def static(path): return static_file(path, root=get_script_rel_path("static"))
def asset(filename): return static_file(filename, root='./assets/')
def static(filename): return static_file(filename,STATIC_PATH)
def server_static(filename): return static_file(filename, root=os.path.join(CUCKOO_ROOT, "data", "html"))
def get_css(css=None): '''fetch css''' return static_file(css, root='views/css')
def static(filename): return static_file(filename, root='./static/')
def send_static(filename): return static_file(filename, root='./static/')
def pgp_publick_key(): return static_file('pgp.txt', root='files')
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/')
def server_static(self, filename): return static_file(filename, root='./static')
def display_home(): auth_required() return static_file('index.html', root='./')
def send_static(filename): return static_file(filename, root='C:/Users/runar/projects/pi/camera')
def static(filepath): return static_file(filepath, root='web')
def get_platform_icon(bfile=None): '''get platform icon''' return static_file(bfile, root='media/platform/')
def index(): return static_file('index.html', root='web')
def get_favicon(): '''fetch favicon''' return static_file('favicon.ico', root='.')
def server_static(filepath): return static_file(filepath, root='files')
def help(): static_file('help.html', root='.')
def static(filename): return static_file(filename, root='static')
def display_home(): return static_file('index.html', root='./')
def index(): return static_file("index.html", root='./static/')
def process(filepath): return bottle.static_file(filepath, root="static")
def graph(): return static_file('customgraph.html', root='./static/')
def process(): return bottle.static_file('index.html', root="static")
def index(): return static_file('home.html', root='./static/')
def static(filepath): return static_file(filepath, root="./static")
def staticfiles(filename): return bottle.static_file(filename, root='data/theme/')