def test_ims(self): """ SendFile: If-Modified-Since""" request.environ['HTTP_IF_MODIFIED_SINCE'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()) try: send_file(os.path.basename(__file__), root='./') except HTTPError, e: self.assertEqual(304 ,e.status)
def test_mime(self): """ SendFile: Mime Guessing""" try: send_file(os.path.basename(__file__), root='./') except BreakTheBottle, e: self.assertTrue( response.content_type in ('application/x-python-code', 'text/x-python'))
def accessions(id): session = Session(SESSION_DIR, id) accession = request.GET.get('accession') if accession: return template('blast_progress', session=session, accession=accession) else: send_file('accessions.html', root=session.dir)
def serve_resources(file): try: if file.endswith(".gz"): response.headers['Content-Encoding'] = "gzip" except Exception as e: print(e) send_file(file, root='web/')
def download(filename): testBottle.logger.info( "pouet %s, path: %s", filename, str(os.path.join(testBottle.rootPath, "files", "uploads"))) send_file(filename, root=os.path.join(testBottle.rootPath, "files", "machine", "scanFiles"), download=filename)
def framework_log_full(fid, log_type): sid = get_slave().id if sid != -1: dir = "%s/slave-%s/fw-%s" % (work_dir, sid, fid) i = max(os.listdir(dir)) exec_dir = "%s/slave-%s/fw-%s/%s" % (work_dir, sid, fid, i) send_file(log_type, root=exec_dir, guessmime=False, mimetype="text/plain") else: abort(403, "Slave not yet registered with master")
def test_ims(self): """ SendFile: If-Modified-Since""" request.environ['HTTP_IF_MODIFIED_SINCE'] = time.strftime( "%a, %d %b %Y %H:%M:%S GMT", time.gmtime()) response.bind() try: send_file(os.path.basename(__file__), root='./') except HTTPError, e: self.assertEqual(304, e.http_status)
def instance_occ_envelope_gif(model, instance, ls_id): """ Return the occupancy envelope for an instance as a gif """ dm = model idx = int(instance) if not validate_instance(dm, idx): abort(404, "No such instance") instance = dm.get_instances()[idx] # do per lifestage! fn = instance.get_occ_envelope_img_filenames(ls=ls_id, gif=True) root_dir = os.path.dirname(fn) send_file(os.path.basename(fn), root=root_dir)
def framework_log_full(fid, log_type): sid = get_slave().id if sid != -1: dir = '%s/slave-%s/fw-%s' % (work_dir, sid, fid) i = max(os.listdir(dir)) exec_dir = '%s/slave-%s/fw-%s/%s' % (work_dir, sid, fid, i) send_file(log_type, root=exec_dir, guessmime=False, mimetype='text/plain') else: abort(403, 'Slave not yet registered with master')
def framework_log_full(fid, eid, log_type): url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json" data = urllib.urlopen(url).read() state = json.loads(data) sid = state["id"] if sid != -1: dir = "%s/slaves/%s/frameworks/%s/executors/%s/runs/" % (work_dir, sid, fid, eid) i = max(os.listdir(dir)) exec_dir = "%s/slaves/%s/frameworks/%s/executors/%s/runs/%s" % (work_dir, sid, fid, eid, i) send_file(log_type, root=exec_dir, guessmime=False, mimetype="text/plain") else: abort(403, "Slave not yet registered with master")
def framework_log_full(fid, eid, log_type): url = "http://localhost:" + slave_port + "/slave/state.json" data = urllib.urlopen(url).read() state = json.loads(data) sid = state['id'] if sid != -1: dir = '%s/slaves/%s/frameworks/%s/executors/%s/runs/' % (work_dir, sid, fid, eid) i = max(os.listdir(dir)) exec_dir = '%s/slaves/%s/frameworks/%s/executors/%s/runs/%s' % (work_dir, sid, fid, eid, i) send_file(log_type, root = exec_dir, guessmime = False, mimetype = 'text/plain') else: abort(403, 'Slave not yet registered with master')
def framework_log_full(fid, log_type): url = "http://localhost:" + slave_port + "/slave/state.json" data = urllib.urlopen(url).read() state = json.loads(data) sid = state['id'] if sid != -1: dir = '%s/slave-%s/fw-%s' % (work_dir, sid, fid) i = max(os.listdir(dir)) exec_dir = '%s/slave-%s/fw-%s/%s' % (work_dir, sid, fid, i) send_file(log_type, root = exec_dir, guessmime = False, mimetype = 'text/plain') else: abort(403, 'Slave not yet registered with master')
def replicate_spread_gif(model, instance, replicate, ls_id): dm = model idx = int(instance) if not validate_instance(dm, idx): abort(404, "No such instance") instance = dm.get_instances()[idx] replicate = int(replicate) if not validate_replicate(instance, replicate): abort(404, "No such replicate, or replicate doesn't exist yet") r = instance.replicates[replicate] # do per lifestage! fn = r.get_base_filenames(ls=ls_id, extension='_anim.gif', single_file=True) root_dir = os.path.dirname(fn) send_file(os.path.basename(fn), root=root_dir)
def instance_occ_envelope_map_pack(model, instance, ls_id): dm = model idx = int(instance) if not validate_instance(dm, idx): abort(404, "No such instance") instance = dm.get_instances()[idx] # do per lifestage! fn = instance.get_occ_envelope_img_filenames( ls=ls_id, extension=False, gif=True) fn += '.zip' if os.path.isfile(fn): add_to_map_pack_lfu(fn) root_dir = os.path.dirname(fn) send_file(os.path.basename(fn), root=root_dir) abort(404, "No map pack generated")
def instance_occ_envelope_map_pack(model, instance, ls_id): dm = model idx = int(instance) if not validate_instance(dm, idx): abort(404, "No such instance") instance = dm.get_instances()[idx] # do per lifestage! fn = instance.get_occ_envelope_img_filenames(ls=ls_id, extension=False, gif=True) fn += '.zip' if os.path.isfile(fn): add_to_map_pack_lfu(fn) root_dir = os.path.dirname(fn) send_file(os.path.basename(fn), root=root_dir) abort(404, "No map pack generated")
def static_file(filename): log.debug("'%s'" % filename) if filename == '/jquery-ui.js': send_file('/usr/share/javascript/jquery-ui/jquery-ui.js') #TODO: support other distros elif filename == 'jquery.min.js': send_file('/usr/share/javascript/jquery/jquery.min.js', root='/') elif filename == 'jquery-ui.custom.css': #TODO: support version change send_file('/usr/share/javascript/jquery-ui/css/smoothness/jquery-ui-1.7.2.custom.css') else: send_file(filename, root='static')
def static_file(filename): """Serving static files, allowing two directories at maximum.""" log.debug("'%s'" % filename) # print filename if filename == '/jquery-ui.js': send_file('/usr/share/javascript/jquery-ui/jquery-ui.js') elif filename == 'jquery.min.js': send_file('/usr/share/javascript/jquery/jquery.min.js', root='/') elif filename == 'jquery-ui.custom.css': #TODO: support version change send_file('/usr/share/javascript/jquery-ui/css/smoothness/jquery-ui-1.7.2.custom.css') else: send_file(filename, root='static')
def static(filename): send_file(filename, root = './webui/static')
def static_file_keys(dir,filename): ## request.environ['HTTP_IF_MODIFIED_SINCE'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(100)) send_file(filename, root=setup.keydir+'/'+dir, mimetype='text/plain')
def image_file2(filename, f): print filename return send_file(filename + "/" + f, root=os.getcwd() + "/images/")
def image_file(filename): print filename return send_file(filename, root=os.getcwd() + "/images/")
def index(): send_file("index.html", root=os.path.join(testBottle.rootPath, 'files', "static"))
def server_static(path): send_file(path, root=os.path.join(testBottle.rootPath, "files", "static", "css"))
def image_file(filename): return send_file( filename, root=os.getcwd()+'/images/' )
def static_resources(filename): send_file(filename, root=resource_dir)
def static(filename): send_file(filename, root=webui_dir + '/static')
def static_file(filename): bottle.send_file(filename, root=os.path.join(os.environ['OPENSHIFT_REPO_DIR'], 'wsgi', 'static'))
def static_file(filename): """Archivos estáticos (CSS etc)""" bottle.send_file(filename, root='./static/')
def static_file(filename): send_file(filename, root='static')
def static_file(filename): bottle.send_file(filename, root='static/')
def static_file(filename): send_file(filename, root='./static/css/')
def log_full(level): send_file('mesos-master.' + level, root = log_dir, guessmime = False, mimetype = 'text/plain')
def log_file(filename): return send_file( filename, root=os.getcwd()+ uploads )
def static_file(filename): send_file(filename, root='/path/to/static/files/')
def sendimage(image): bottle.send_file(image, root='static/images')
def flot(filename): send_file(filename, root=APP_CWD + '/static/flot/')
def static_file(filename): send_file(filename, root=os.path.join(testBottle.rootPath, 'files', "static"))
def server_static(path): response.headers['Cache-Control'] = "no-store, no-cache, must-revalidate" response.headers['Pragma'] = "no-cache" response.headers['expires'] = 0 send_file(path, root=os.path.join(testBottle.rootPath, "files", "static", "img"))
def static_file(filename): send_file(filename, root='static/images')
def favi(): return send_file("favicon.ico", root=os.getcwd() + "/images/")
def static_file(filename): send_file(filename, root='static/css')
def style(name): bottle.send_file(name, root='static')
def static_file(filename): send_file(filename, root='/root/work/code/lanzw_bottle/evolution/evolution_02/')
def static_file(filename): send_file(filename, root='../redweb/static')
def static_file(filename): """Archivos estáticos (CSS etc)""" bottle.send_file(filename, root="./static/")
def style(name): bottle.send_file(name,root='static')
def static_file(filename): return send_file( filename, root=os.getcwd()+'/static/' )
def sendimage(image): bottle.send_file(image,root='static/images')
def favi(): return send_file( 'favicon.ico', root=os.getcwd()+'/images/' )
def static_resources(): send_file("favicon.ico", root=resource_dir)
def static(filename): send_file(filename, root = webui_dir + '/static')
def static(filename): send_file(filename, root=APP_CWD + '/static')
def favicon(): send_file('favicon.ico', root='static')