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)
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)
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)
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
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
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)