modifié: m/fichier/conf

modifié:         m/loadConf.py
	nouveau fichier: m/log.py
	modifié:         m/login.py
	modifié:         superTornado.py
This commit is contained in:
sidya82
2014-03-02 22:57:48 +01:00
parent 70c0d27716
commit f1904ed512
5 changed files with 54 additions and 21 deletions

View File

@ -1 +1,3 @@
handicap=1
blind=1
camera=192.168.1.13
port=80

View File

@ -1,16 +1,25 @@
class LoadConf(object):
def loadHand(self):
def loadValue(self, key):
with open("m/fichier/conf", "r") as source :
for ligne in source:
data = ligne.rstrip('\n\r').split('=')
if data[0] in 'handicap' :
if data[0] in key :
source.close()
return data[1]
source.close()
return 0
return "error"
def estAveugle(self):
if self.loadHand() == "1" :
def isBlind(self):
rep = self.loadValue("blind")
if rep == "1" :
return True
else :
else if rep == "0":
return False
else :
return rep
def ipCamera(self)
return self.loadValue("camera")
def portServ(self)
return self.loadValue("port")

8
m/log.py Normal file
View File

@ -0,0 +1,8 @@
import time
from datetime import datetime
class Log(object):
def enregDansLog(self,pLog,pMsg,pIP):
with open("m/fichier/log", "a") as dest :
d = datetime.now().strftime("%c")
dest.write("%s,%s,%s,%s\n" % (d,pLog,pMsg,pIP))

View File

@ -1,7 +1,6 @@
import time
import hashlib
import httplib
from datetime import datetime
class Login(object):
def verifLogin(self,pLog,pMdp):
@ -16,11 +15,6 @@ class Login(object):
source.close()
return False
def enregDansLog(self,pLog,pMsg,pIP):
with open("m/fichier/log", "a") as dest :
d = datetime.now().strftime("%c")
dest.write("%s,%s,%s,%s\n" % (d,pLog,pMsg,pIP))
def connexion(self,pLog,pMdp):
if self.verifLogin(pLog,pMdp) == True :
return True