예제 #1
0
파일: study.py 프로젝트: temi/phylografter
def export_NexSON():
    'Exports the otus and trees in the study specified by the argument as JSON NeXML'
    studyid = request.args(0)
    if (db.study(studyid) is None):
        raise HTTP(404)
    else:
        return nexson.nexmlStudy(studyid,db)
예제 #2
0
def export_NexSON():
    'Exports the otus and trees in the study specified by the argument as JSON NeXML'
    studyid = request.args(0)
    if (db.study(studyid) is None):
        raise HTTP(404)
    else:
        return nexson.nexmlStudy(studyid, db)
예제 #3
0
def fetch_nexson(study_id):
    try:
        study_id = int(study_id)
    except ValueError:
        raise HTTP(404)
    if not db.study(study_id): raise HTTP(404)
    return nexson.nexmlStudy(study_id, db)
예제 #4
0
파일: study.py 프로젝트: temi/phylografter
def export_gzipNexSON():
    'Exports the otus and trees in the study specified by the argument as gzipped JSON NeXML'
    studyid = request.args(0)
    if (db.study(studyid) is None):
        raise HTTP(404)
    else:
        from gluon.serializers import json
        import cStringIO
        stream = cStringIO.StringIO()
        jsondict = nexson.nexmlStudy(studyid,db)
        jsonText = json(jsondict)
        zipfilename = "study%s.json.gz" % studyid
        gzfile = gzip.GzipFile(filename=zipfilename, mode="wb", fileobj=stream)
        gzfile.write(jsonText)
        gzfile.write("\n")
        gzfile.close() 
        response.headers['Content-Type'] = "application/gzip"
        response.headers['Content-Disposition'] = "attachment;filename=%s"%zipfilename
        return stream.getvalue()              
    return
예제 #5
0
def export_gzipNexSON():
    'Exports the otus and trees in the study specified by the argument as gzipped JSON NeXML'
    studyid = request.args(0)
    if (db.study(studyid) is None):
        raise HTTP(404)
    else:
        from gluon.serializers import json
        import cStringIO
        stream = cStringIO.StringIO()
        jsondict = nexson.nexmlStudy(studyid, db)
        jsonText = json(jsondict)
        zipfilename = "study%s.json.gz" % studyid
        gzfile = gzip.GzipFile(filename=zipfilename, mode="wb", fileobj=stream)
        gzfile.write(jsonText)
        gzfile.write("\n")
        gzfile.close()
        response.headers['Content-Type'] = "application/gzip"
        response.headers[
            'Content-Disposition'] = "attachment;filename=%s" % zipfilename
        return stream.getvalue()
    return
예제 #6
0
파일: study.py 프로젝트: temi/phylografter
def fetch_nexson(study_id):
    try: study_id = int(study_id)
    except ValueError: raise HTTP(404)
    if not db.study(study_id): raise HTTP(404)
    return nexson.nexmlStudy(study_id,db)