Пример #1
0
 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)
Пример #2
0
 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'))
Пример #3
0
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)
Пример #4
0
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/') 
Пример #5
0
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)
Пример #6
0
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/')
Пример #7
0
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")
Пример #8
0
 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)
Пример #9
0
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)
Пример #10
0
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)
Пример #11
0
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')
Пример #12
0
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")
Пример #13
0
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')
Пример #14
0
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')
Пример #15
0
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)
Пример #16
0
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")
Пример #17
0
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)
Пример #18
0
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")
Пример #19
0
 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')
Пример #20
0
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')
Пример #21
0
def static(filename):
  send_file(filename, root = './webui/static')
Пример #22
0
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')	
Пример #23
0
def image_file2(filename, f):
    print filename
    return send_file(filename + "/" + f, root=os.getcwd() + "/images/")
Пример #24
0
def image_file(filename):
    print filename
    return send_file(filename, root=os.getcwd() + "/images/")
Пример #25
0
def index():
    send_file("index.html",
              root=os.path.join(testBottle.rootPath, 'files', "static"))
Пример #26
0
def server_static(path):
    send_file(path,
              root=os.path.join(testBottle.rootPath, "files", "static", "css"))
Пример #27
0
def image_file(filename):
	return send_file( filename, root=os.getcwd()+'/images/' )
Пример #28
0
def static_resources(filename):
    send_file(filename, root=resource_dir)
Пример #29
0
def static(filename):
    send_file(filename, root=webui_dir + '/static')
Пример #30
0
def static_file(filename):
    bottle.send_file(filename,
                     root=os.path.join(os.environ['OPENSHIFT_REPO_DIR'],
                                       'wsgi', 'static'))
Пример #31
0
def static_file(filename):
    """Archivos estáticos (CSS etc)"""
    bottle.send_file(filename, root='./static/')
Пример #32
0
def static_file(filename):
    send_file(filename, root='static')
Пример #33
0
def static_file(filename):
    bottle.send_file(filename, root='static/')
Пример #34
0
def static_file(filename):
    send_file(filename, root='./static/css/')
Пример #35
0
def log_full(level):
  send_file('mesos-master.' + level, root = log_dir,
            guessmime = False, mimetype = 'text/plain')
Пример #36
0
def log_file(filename):
	return send_file( filename, root=os.getcwd()+ uploads )
Пример #37
0
def static_file(filename):
    send_file(filename, root='/path/to/static/files/')
Пример #38
0
def sendimage(image):
    bottle.send_file(image, root='static/images')
Пример #39
0
def flot(filename):
    send_file(filename, root=APP_CWD + '/static/flot/')
Пример #40
0
def static_file(filename):
    send_file(filename,
              root=os.path.join(testBottle.rootPath, 'files', "static"))
Пример #41
0
def static_file(filename):
    send_file(filename, root='./static/css/')
Пример #42
0
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"))
Пример #43
0
def static_file(filename):
    send_file(filename, root='static/images')
Пример #44
0
def favi():
    return send_file("favicon.ico", root=os.getcwd() + "/images/")
Пример #45
0
def static_file(filename):
    send_file(filename, root='static/css')
Пример #46
0
def style(name):
    bottle.send_file(name, root='static')
Пример #47
0
def static_file(filename):
    send_file(filename,
              root='/root/work/code/lanzw_bottle/evolution/evolution_02/')
Пример #48
0
def log_full(level):
  send_file('mesos-master.' + level, root = log_dir,
            guessmime = False, mimetype = 'text/plain')
Пример #49
0
def static_file(filename):
    send_file(filename, root='../redweb/static')
Пример #50
0
def static_file(filename):
    """Archivos estáticos (CSS etc)"""
    bottle.send_file(filename, root="./static/")
Пример #51
0
def style(name):
    bottle.send_file(name,root='static')
Пример #52
0
def static_file(filename):
	return send_file( filename, root=os.getcwd()+'/static/' )
Пример #53
0
def sendimage(image):
    bottle.send_file(image,root='static/images')
Пример #54
0
def favi():
	return send_file( 'favicon.ico', root=os.getcwd()+'/images/' )
Пример #55
0
def static_resources():
    send_file("favicon.ico", root=resource_dir)
Пример #56
0
def static(filename):
  send_file(filename, root = webui_dir + '/static')
Пример #57
0
def static(filename):
    send_file(filename, root=APP_CWD + '/static')
Пример #58
0
def static_file(filename):
  bottle.send_file(filename, root='static/')
Пример #59
0
def favicon():
    send_file('favicon.ico', root='static')