This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
DUT2PTUT/m/loadConf.py
sidya82 6873595ffd modifié: Doxyfile
modifié:         doc/html/annotated.html
	modifié:         doc/html/classes.html
	modifié:         doc/html/classm_1_1load_conf_1_1_config_error-members.html
	modifié:         doc/html/classm_1_1load_conf_1_1_config_error.html
	modifié:         doc/html/classm_1_1load_conf_1_1_load_conf-members.html
	modifié:         doc/html/classm_1_1load_conf_1_1_load_conf.html
	modifié:         doc/html/classm_1_1log_1_1_log-members.html
	modifié:         doc/html/classm_1_1log_1_1_log.html
	modifié:         doc/html/classm_1_1log_1_1_single_level_filter-members.html
	modifié:         doc/html/classm_1_1log_1_1_single_level_filter.html
	modifié:         doc/html/classm_1_1log_1_1bcolors-members.html
	modifié:         doc/html/classm_1_1log_1_1bcolors.html
	modifié:         doc/html/classm_1_1log_1_1lvl-members.html
	modifié:         doc/html/classm_1_1log_1_1lvl.html
	modifié:         doc/html/classm_1_1login_1_1_login-members.html
	modifié:         doc/html/classm_1_1login_1_1_login.html
	modifié:         doc/html/classsuper_tornado_1_1_base_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_base_handler.html
	modifié:         doc/html/classsuper_tornado_1_1_disconnection_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_disconnection_handler.html
	modifié:         doc/html/classsuper_tornado_1_1_global_vars-members.html
	modifié:         doc/html/classsuper_tornado_1_1_global_vars.html
	modifié:         doc/html/classsuper_tornado_1_1_main_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_main_handler.html
	modifié:         doc/html/classsuper_tornado_1_1_unauthorized_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_unauthorized_handler.html
	modifié:         doc/html/classsuper_tornado_1_1_video_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_video_handler.html
	modifié:         doc/html/classsuper_tornado_1_1_w_socket_handler-members.html
	modifié:         doc/html/classsuper_tornado_1_1_w_socket_handler.html
	modifié:         doc/html/dir_060e062f70a4a7965197b0046a5699c1.html
	modifié:         doc/html/dir_b9f9e361513c934f24957ae0a3633a41.html
	modifié:         doc/html/dir_cc95ad066e2e041bbee057a78f4a0df2.html
	modifié:         doc/html/functions.html
	modifié:         doc/html/functions_func.html
	modifié:         doc/html/hierarchy.html
	modifié:         doc/html/index.html
	modifié:         doc/html/md__r_e_a_d_m_e.html
	modifié:         doc/html/namespacemembers.html
	modifié:         doc/html/namespacemembers_func.html
	modifié:         doc/html/namespaces.html
	modifié:         doc/html/namespacesuper_tornado.html
	modifié:         doc/html/pages.html
	modifié:         doc/latex/classm_1_1load_conf_1_1_config_error.pdf
	modifié:         doc/latex/classm_1_1load_conf_1_1_load_conf.pdf
	modifié:         doc/latex/classm_1_1log_1_1_log.pdf
	modifié:         doc/latex/classm_1_1log_1_1_single_level_filter.pdf
	modifié:         doc/latex/classm_1_1login_1_1_login.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_base_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_base_handler.tex
	modifié:         doc/latex/classsuper_tornado_1_1_disconnection_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_disconnection_handler.tex
	modifié:         doc/latex/classsuper_tornado_1_1_global_vars.tex
	modifié:         doc/latex/classsuper_tornado_1_1_main_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_main_handler.tex
	modifié:         doc/latex/classsuper_tornado_1_1_unauthorized_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_unauthorized_handler.tex
	modifié:         doc/latex/classsuper_tornado_1_1_video_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_video_handler.tex
	modifié:         doc/latex/classsuper_tornado_1_1_w_socket_handler.pdf
	modifié:         doc/latex/classsuper_tornado_1_1_w_socket_handler.tex
	modifié:         doc/latex/refman.tex
	modifié:         doc/man/man3/_home_sidya_Documents_iut_ptut_m_.3
	modifié:         doc/man/man3/_home_sidya_Documents_iut_ptut_v_.3
	modifié:         doc/man/man3/_home_sidya_Documents_iut_ptut_v_js_.3
	modifié:         doc/man/man3/m_loadConf_ConfigError.3
	modifié:         doc/man/man3/m_loadConf_LoadConf.3
	modifié:         doc/man/man3/m_log_Log.3
	modifié:         doc/man/man3/m_log_SingleLevelFilter.3
	modifié:         doc/man/man3/m_log_bcolors.3
	modifié:         doc/man/man3/m_log_lvl.3
	modifié:         doc/man/man3/m_login_Login.3
	modifié:         doc/man/man3/md__r_e_a_d_m_e.3
	modifié:         doc/man/man3/superTornado.3
	modifié:         doc/man/man3/superTornado_BaseHandler.3
	modifié:         doc/man/man3/superTornado_DisconnectionHandler.3
	modifié:         doc/man/man3/superTornado_GlobalVars.3
	modifié:         doc/man/man3/superTornado_MainHandler.3
	modifié:         doc/man/man3/superTornado_UnauthorizedHandler.3
	modifié:         doc/man/man3/superTornado_VideoHandler.3
	modifié:         doc/man/man3/superTornado_WSocketHandler.3
	modifié:         m/loadConf.py
	modifié:         superTornado.py
	modifié:         test/botTest.py
2014-04-03 16:35:54 +02:00

104 lines
2.3 KiB
Python

class LoadConf(object):
"""Loading configuration file"""
def __init__(self,path):
"""
Define file path for load config
"""
self.path = path
def loadValue(self, key):
"""
Return the value associate to the key into conf file (fichier/conf)
Else return "error"
"""
with open(self.path , "r") as source :
for ligne in source:
data = ligne.rstrip('\r\n').split(' ')
if data[0] == key :
source.close()
return data[1]
source.close()
return "error"
def isBlind(self):
"""
Return true if configuration is for Blind
Else false
"""
rep = self.loadValue("blind")
if rep == "1" :
return True
elif rep == "0":
return False
else :
return rep
def ipCamera(self) :
"""
Return ipCamera configuration
Else "error"
"""
return self.loadValue("ipCamera")
def portCamera(self) :
"""
Return portCamera configuration
Else "error"
"""
return self.loadValue("portCamera")
def ipServ(self) :
"""
Return ipServ configuration
Else "error"
"""
return self.loadValue("ipServ")
def portServ(self) :
"""
Return portServ configuration
Else "error"
"""
return self.loadValue("portServ")
def idUrlCamera(self) :
"""
Return idUrlCamera configuration
Else "error"
"""
return self.loadValue("idUrlCamera")
def endUrlCamera(self) :
"""
Return endUrlCamera configuration
Else "error"
"""
return self.loadValue("endUrlCamera")
def ipDomo(self) :
"""
Return ipDomoMi configuration
Else "error"
"""
return self.loadValue("ipDomoMi")
def portDomo(self) :
"""
Return portDomoMi configuration
Else "error"
"""
return self.loadValue("portDomoMi")
class ConfigError(Exception):
"""Exception : error loading configuration"""
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)