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

39 lines
903 B
Python
Raw Normal View History

class LoadConf(object):
def loadValue(self, key):
2014-03-01 22:04:15 +01:00
with open("m/fichier/conf", "r") as source :
for ligne in source:
data = ligne.rstrip('\n\r').split('=')
2014-03-03 00:57:20 +01:00
if data[0] == key :
source.close()
return data[1]
source.close()
return "error"
def isBlind(self):
rep = self.loadValue("blind")
if rep == "1" :
return True
2014-03-02 23:04:55 +01:00
elif rep == "0":
return False
else :
return rep
2014-03-02 23:05:54 +01:00
def ipCamera(self) :
return self.loadValue("camera")
def portCamera(self) :
return self.loadValue("portCamera")
2014-03-02 23:05:54 +01:00
def portServ(self) :
return self.loadValue("portServ")
class ConfigError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
2014-03-02 23:38:11 +01:00