Esempio n. 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)
Esempio n. 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'))
Esempio n. 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)
Esempio n. 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/') 
Esempio n. 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)
Esempio n. 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/')
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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')
Esempio n. 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")
Esempio n. 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')
Esempio n. 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')
Esempio n. 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)
Esempio n. 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")
Esempio n. 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)
Esempio n. 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")
Esempio n. 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')
Esempio n. 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')
Esempio n. 21
0
def static(filename):
  send_file(filename, root = './webui/static')
Esempio n. 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')	
Esempio n. 23
0
def image_file2(filename, f):
    print filename
    return send_file(filename + "/" + f, root=os.getcwd() + "/images/")
Esempio n. 24
0
def image_file(filename):
    print filename
    return send_file(filename, root=os.getcwd() + "/images/")
Esempio n. 25
0
def index():
    send_file("index.html",
              root=os.path.join(testBottle.rootPath, 'files', "static"))
Esempio n. 26
0
def server_static(path):
    send_file(path,
              root=os.path.join(testBottle.rootPath, "files", "static", "css"))
Esempio n. 27
0
def image_file(filename):
	return send_file( filename, root=os.getcwd()+'/images/' )
Esempio n. 28
0
def static_resources(filename):
    send_file(filename, root=resource_dir)
Esempio n. 29
0
def static(filename):
    send_file(filename, root=webui_dir + '/static')
Esempio n. 30
0
def static_file(filename):
    bottle.send_file(filename,
                     root=os.path.join(os.environ['OPENSHIFT_REPO_DIR'],
                                       'wsgi', 'static'))
Esempio n. 31
0
def static_file(filename):
    """Archivos estáticos (CSS etc)"""
    bottle.send_file(filename, root='./static/')
Esempio n. 32
0
def static_file(filename):
    send_file(filename, root='static')
Esempio n. 33
0
def static_file(filename):
    bottle.send_file(filename, root='static/')
Esempio n. 34
0
def static_file(filename):
    send_file(filename, root='./static/css/')
Esempio n. 35
0
def log_full(level):
  send_file('mesos-master.' + level, root = log_dir,
            guessmime = False, mimetype = 'text/plain')
Esempio n. 36
0
def log_file(filename):
	return send_file( filename, root=os.getcwd()+ uploads )
Esempio n. 37
0
def static_file(filename):
    send_file(filename, root='/path/to/static/files/')
Esempio n. 38
0
def sendimage(image):
    bottle.send_file(image, root='static/images')
Esempio n. 39
0
def flot(filename):
    send_file(filename, root=APP_CWD + '/static/flot/')
Esempio n. 40
0
def static_file(filename):
    send_file(filename,
              root=os.path.join(testBottle.rootPath, 'files', "static"))
Esempio n. 41
0
def static_file(filename):
    send_file(filename, root='./static/css/')
Esempio n. 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"))
Esempio n. 43
0
File: main.py Progetto: apg/muxtube
def static_file(filename):
    send_file(filename, root='static/images')
Esempio n. 44
0
def favi():
    return send_file("favicon.ico", root=os.getcwd() + "/images/")
Esempio n. 45
0
File: main.py Progetto: apg/muxtube
def static_file(filename):
    send_file(filename, root='static/css')
Esempio n. 46
0
def style(name):
    bottle.send_file(name, root='static')
Esempio n. 47
0
def static_file(filename):
    send_file(filename,
              root='/root/work/code/lanzw_bottle/evolution/evolution_02/')
Esempio n. 48
0
def log_full(level):
  send_file('mesos-master.' + level, root = log_dir,
            guessmime = False, mimetype = 'text/plain')
Esempio n. 49
0
def static_file(filename):
    send_file(filename, root='../redweb/static')
Esempio n. 50
0
def static_file(filename):
    """Archivos estáticos (CSS etc)"""
    bottle.send_file(filename, root="./static/")
Esempio n. 51
0
def style(name):
    bottle.send_file(name,root='static')
Esempio n. 52
0
def static_file(filename):
	return send_file( filename, root=os.getcwd()+'/static/' )
Esempio n. 53
0
def sendimage(image):
    bottle.send_file(image,root='static/images')
Esempio n. 54
0
def favi():
	return send_file( 'favicon.ico', root=os.getcwd()+'/images/' )
Esempio n. 55
0
def static_resources():
    send_file("favicon.ico", root=resource_dir)
Esempio n. 56
0
def static(filename):
  send_file(filename, root = webui_dir + '/static')
Esempio n. 57
0
def static(filename):
    send_file(filename, root=APP_CWD + '/static')
Esempio n. 58
0
def static_file(filename):
  bottle.send_file(filename, root='static/')
Esempio n. 59
0
def favicon():
    send_file('favicon.ico', root='static')