#!/usr/bin/python # -*- coding: utf-8 -*- import sys, os, re, cgi, time #Repertoire a changer sous Unix : rep="/home/projets/treecloud/WORK/" rep_antidico="/home/projets/treecloud/ANTIDICOS/" #Definition des noms de fichiers en sortie: params={} param=cgi.FieldStorage() num="0" verbose=0 fichiertexte=rep+"text"+num fichierMat="" #fichierMat=" -fileCSV "+rep+"Mat"+num fichierNewick=rep+"Newick"+num+".txt" fichierDistance=rep+"dist"+num+".txt" fichierNexus=rep+"nex"+num+".txt" fichierdessin="dessin"+num+".svg" #repdessin="./" repdessin="/home/projets/treecloud/WORK/" repdessin2="http://treecloud.univ-mlv.fr/WORK/" fichierfreq=rep+"Frequences"+num+".txt" fichierantidico="" text="PASTE YOUR TEXT HERE" print """ Content-type: text/html
""" for clef in param.keys() : params[clef]=param.getvalue(clef) if params.has_key("minuscules"): minuscules=params["minuscules"] else: minuscules="NON" if params.has_key("anti_perso"): anti_perso=params["anti_perso"] else: anti_perso="NON" if params.has_key("debug"): debug=params["debug"] else: debug="NON" if params.has_key("legend"): legend=params["legend"] else: legend="NON" if params.has_key("typedistance"): typedistance=params["typedistance"] else: typedistance="jaccard" if params.has_key("text1"): text=params["text1"] fd=open(fichiertexte+"1.txt","w") fd.write(text) fd.close() if params.has_key("antidico1"): fichierantidico=rep+"Antidico_Perso.txt" fd=open(fichierantidico,"w") fd.write(params["antidico1"]) fd.close() if params.has_key("taillefenetre"): taillefenetre=params["taillefenetre"] else: taillefenetre="20" if params.has_key("nombremaxmots"): nombremaxmots=params["nombremaxmots"] else: nombremaxmots="50" if params.has_key("nombreminmots"): nombreminmots=params["nombreminmots"] else: nombreminmots="0" if params.has_key("hauteur"): hauteur=params["hauteur"] else: hauteur="600" if params.has_key("largeur"): largeur=params["largeur"] else: largeur="600" if params.has_key("antidico"): antidico=params["antidico"] else: antidico="" if params.has_key("langue"): langue=params["langue"] else: langue="FR" if fichierantidico!="": fichierantidico="-fileantidico "+fichierantidico imagetaille="-image_width "+largeur+" -image_height "+hauteur if params.has_key("big"): if params["big"]=="big": imagetaille="-image_width 2000 -image_height 2000" if nombreminmots!="0": nbmots=" -nombreminmots "+nombreminmots nombremaxmots="0" else: nbmots=" -nombremaxmots "+nombremaxmots commande=" -legend "+legend+" -debug "+debug+" -virtuel OUI "+" -anti_perso "+anti_perso+" -langue "+langue+" -workdir "+rep+" -file "+fichiertexte+"1.txt "+nbmots+" -minuscules "+minuscules+" -taillefenetre "+taillefenetre+" -typedistance "+typedistance+" -filegraph "+repdessin+fichierdessin+" -filenewick "+fichierNewick+" -filefrequence "+fichierfreq+" -filedistance "+fichierDistance+" -filenexus "+fichierNexus+" "+imagetaille+fichierMat reponse="..." t1=time.time() cmd=os.popen("/home/projets/treecloud/cgi-bin/ArbreArbore "+commande,"rb") reponse=cmd.read() cmd.close() t2=time.time() t3=t2-t1 if (reponse==""): reponse="Error, please inform me about this bug (please send your parameters)" reponse=reponse+"