def __init__ (self,idsoc,client_address, socket_thread, queue_in, queue_out, mylog, config, server_address): Thread.__init__(self) self.idsoc=idsoc self.server_address=server_address self.client_address=client_address self.socket_thread=socket_thread self.queue_in=queue_in self.queue_out=queue_out self.log=mylog self.config=config self.rfile = None self.wfile = None #surchage possible par config : self.rbufsize = -1 self.wbufsize = 0 self.protocol_version = "HTTP/1.0" self.NAME_SERVER = NAME_SERVER self.sys_version = "Python/" + sys.version.split()[0] self.server_version = self.NAME_SERVER self.version_string = self.server_version + ' ' + self.sys_version self.timer_init=None if self.config.flag_server['TIMER_REQUESTS']: self.log_ts=log(config,fichier="timer_requests.txt",clean=True) self.timer_init=time.time() if self.config.flag_server['TIMER_REQUEST']: self.log_t=log(config,fichier="req-%s.txt" % idsoc) self.trace("start")
def __init__(self,config): # Chargement config self.config=config # Chargement Systeme de log self.log=log(config) #initialise les sessions (normal et openid) self.sessions=Sessions(self.log,config) # Database self.database=Database(self.log,self.config,config.path['sql']) # FS SVN Interface #travail dans une base svn pour l'ecriture des modifs du fs. self.fs_svn=FS_SVN(config.path['svn'],config.path['files'],self.log) #self.fs_svn.creation(repertoiredesdatasinitiales) self.traducteurs=get_traducteurs(self.config) #Calcul de la base url : #TODO check ssl port=config.http['port'] domain=config.http['domain'] #Creation du serveur et demarrage : HTTP_Server.__init__(self, (domain,port), Tekio_Handler, GlobTekio) for (k,v) in config.flag_server.items(): setattr(self,k,v) self.glob.langues=self.config.langues self.glob.langue=self.config.langues[0] self.glob.initialisation(self.database) print 'Serveur pret' self.start()