Plus de log access (apache x'en charge) + amlioration des log intranet
darcs-hash:20061120130620-f46e9-bd15d792ac8ae0785f0d233172090e6d975e43e8.gz
This commit is contained in:
parent
2aa2d53be7
commit
191bf79296
5 changed files with 38 additions and 30 deletions
|
@ -7,7 +7,7 @@ server.socketQueueSize=10
|
||||||
server.protocolVersion="HTTP/1.0"
|
server.protocolVersion="HTTP/1.0"
|
||||||
server.logToScreen=False
|
server.logToScreen=False
|
||||||
server.logFile="/var/log/intranet/cherrypy.log"
|
server.logFile="/var/log/intranet/cherrypy.log"
|
||||||
server.logAccessFile="/var/log/intranet/access.log"
|
server.logAccessFile=""
|
||||||
server.logTracebacks=True
|
server.logTracebacks=True
|
||||||
server.reverseDNS=False
|
server.reverseDNS=False
|
||||||
server.threadPool=10
|
server.threadPool=10
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import cherrypy, tempfile, shutil, os
|
import cherrypy, tempfile, shutil, os
|
||||||
import crans.impression
|
import crans.impression
|
||||||
import crans.impression.digicode
|
import crans.impression.digicode
|
||||||
|
import crans.cp
|
||||||
|
|
||||||
class root:
|
class root:
|
||||||
##########################
|
##########################
|
||||||
|
@ -43,7 +44,7 @@ class root:
|
||||||
liste_formatee.append({'code':aCode[0], 'age':age_string, 'desc':aCode[2]})
|
liste_formatee.append({'code':aCode[0], 'age':age_string, 'desc':aCode[2]})
|
||||||
return {'codes': liste_formatee}
|
return {'codes': liste_formatee}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log('erreur lors de la creation de la liste de codes :' + str(e), 'DIGICODE', 1)
|
crans.cp.log('erreur lors de la creation de la liste de codes :' + str(e), 'DIGICODE', 1)
|
||||||
return {'erreur':str(e)}
|
return {'erreur':str(e)}
|
||||||
codeList.exposed= True
|
codeList.exposed= True
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class root:
|
||||||
def createCode(self, code=None, adherent=''):
|
def createCode(self, code=None, adherent=''):
|
||||||
try:
|
try:
|
||||||
if adherent == '':
|
if adherent == '':
|
||||||
adherent = cherrypy.session['uid']
|
adherent = cherrypy.session['uid']
|
||||||
if code:
|
if code:
|
||||||
try:
|
try:
|
||||||
int(code)
|
int(code)
|
||||||
|
@ -64,9 +65,9 @@ class root:
|
||||||
code = crans.impression.digicode.save_code(code, adherent)
|
code = crans.impression.digicode.save_code(code, adherent)
|
||||||
else:
|
else:
|
||||||
code = crans.impression.digicode.gen_code(adherent)
|
code = crans.impression.digicode.gen_code(adherent)
|
||||||
cherrypy.log("code cree : %s" % code, 'DIGICODE')
|
crans.cp.log("code cree : %s" % code, 'DIGICODE')
|
||||||
return {'code': code, "age" : "new", "desc":adherent}
|
return {'code': code, "age" : "new", "desc":adherent}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log("erreur lors de la creation de code : " + str(e), 'DIGICODE', 1)
|
crans.cp.log("erreur lors de la creation de code : " + str(e), 'DIGICODE', 1)
|
||||||
return {'erreur':str(e)}
|
return {'erreur':str(e)}
|
||||||
createCode.exposed= True
|
createCode.exposed= True
|
||||||
|
|
|
@ -3,7 +3,7 @@ import cherrypy, tempfile, shutil, os
|
||||||
import crans.impression
|
import crans.impression
|
||||||
import crans.impression.digicode
|
import crans.impression.digicode
|
||||||
import crans.impression.etat_imprimante
|
import crans.impression.etat_imprimante
|
||||||
|
import crans.cp
|
||||||
FILE_UPLOAD_BASE_FOLDER = cherrypy.config.get('fileUpload.folder', "/var/impression/fichiers/")
|
FILE_UPLOAD_BASE_FOLDER = cherrypy.config.get('fileUpload.folder', "/var/impression/fichiers/")
|
||||||
|
|
||||||
class FileError(Exception):
|
class FileError(Exception):
|
||||||
|
@ -81,7 +81,7 @@ class root:
|
||||||
listeBrute = [item[0] for item in listeBrute if item[2] == cherrypy.session['uid']]
|
listeBrute = [item[0] for item in listeBrute if item[2] == cherrypy.session['uid']]
|
||||||
return {'codes': listeBrute}
|
return {'codes': listeBrute}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log('erreur lors de la creation de la liste de codes :' + str(e), 'IMPRESSION', 1)
|
crans.cp.log('erreur lors de la creation de la liste de codes :' + str(e), 'IMPRESSION', 1)
|
||||||
return {'erreur':str(e)}
|
return {'erreur':str(e)}
|
||||||
codeList.exposed= True
|
codeList.exposed= True
|
||||||
|
|
||||||
|
@ -94,10 +94,10 @@ class root:
|
||||||
cherrypy.session['impression'] = crans.impression.impression(filepath, cherrypy.session['uid'])
|
cherrypy.session['impression'] = crans.impression.impression(filepath, cherrypy.session['uid'])
|
||||||
return {'nbPages': cherrypy.session['impression'].pages()}
|
return {'nbPages': cherrypy.session['impression'].pages()}
|
||||||
except crans.impression.FichierInvalide, e:
|
except crans.impression.FichierInvalide, e:
|
||||||
cherrypy.log("useFile : %s (%s)" % (str(e), e.file()), 'IMPRESSION', 1)
|
crans.cp.log("useFile : %s (%s)" % (str(e), e.file()), 'IMPRESSION', 1)
|
||||||
return {'erreur':str(e) }
|
return {'erreur':str(e) }
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log("useFile : %s" % str(e), 'IMPRESSION', 1)
|
crans.cp.log("useFile : %s" % str(e), 'IMPRESSION', 1)
|
||||||
return {'erreur':str(e) }
|
return {'erreur':str(e) }
|
||||||
useFile.exposed= True
|
useFile.exposed= True
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class root:
|
||||||
try:
|
try:
|
||||||
nouvPrix = cherrypy.session['impression'].changeSettings(papier=papier, couleurs=couleurs, agraphes=agrafes, recto_verso=recto_verso, copies=int(copies))
|
nouvPrix = cherrypy.session['impression'].changeSettings(papier=papier, couleurs=couleurs, agraphes=agrafes, recto_verso=recto_verso, copies=int(copies))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log("changeSettings : %s" % str(e), 'IMPRESSION', 1)
|
crans.cp.log("changeSettings : %s" % str(e), 'IMPRESSION', 1)
|
||||||
return {"erreur":str(e)}
|
return {"erreur":str(e)}
|
||||||
return {'nouvPrix':nouvPrix}
|
return {'nouvPrix':nouvPrix}
|
||||||
changeSettings.exposed = True
|
changeSettings.exposed = True
|
||||||
|
@ -124,9 +124,9 @@ class root:
|
||||||
except crans.impression.SoldeInsuffisant:
|
except crans.impression.SoldeInsuffisant:
|
||||||
return {"SoldeInsuffisant":1}
|
return {"SoldeInsuffisant":1}
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
cherrypy.log("lancerImpression : %s" % str(e), 'IMPRESSION', 1)
|
crans.cp.log("lancerImpression : %s" % str(e), 'IMPRESSION', 1)
|
||||||
return {"erreur":str(e)}
|
return {"erreur":str(e)}
|
||||||
cherrypy.log("impression", 'IMPRESSION')
|
crans.cp.log("impression", 'IMPRESSION')
|
||||||
return {'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#"}
|
return {'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#"}
|
||||||
lancerImpression.exposed = True
|
lancerImpression.exposed = True
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ class root:
|
||||||
os.makedirs(file_folder)
|
os.makedirs(file_folder)
|
||||||
newFilePath = os.path.join(file_folder, aFile.filename)
|
newFilePath = os.path.join(file_folder, aFile.filename)
|
||||||
shutil.move(tempFileName, newFilePath)
|
shutil.move(tempFileName, newFilePath)
|
||||||
cherrypy.log("New file uploaded at : %s" % newFilePath, "IMPRESSION")
|
crans.cp.log("New file uploaded at : %s" % newFilePath, "IMPRESSION")
|
||||||
return newFilePath
|
return newFilePath
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import cherrypy, sys, os, datetime
|
||||||
from time import strftime, localtime, time
|
from time import strftime, localtime, time
|
||||||
# libraries crans
|
# libraries crans
|
||||||
sys.path.append('/usr/scripts/gestion/')
|
sys.path.append('/usr/scripts/gestion/')
|
||||||
|
import crans.cp
|
||||||
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
if (cherrypy.config.configMap["global"]["server.environment"] == "development"):
|
||||||
from ldap_crans_test import *
|
from ldap_crans_test import *
|
||||||
# print("mesmachines : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
# print("mesmachines : unsing test ldap : env=" + cherrypy.config.configMap["global"]["server.environment"])
|
||||||
|
@ -162,13 +162,14 @@ class root:
|
||||||
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||||
del adh, mach
|
del adh, mach
|
||||||
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
||||||
mach.nom(nouveauNom)
|
anciennom = mach.nom()
|
||||||
|
nouveauNom = mach.nom(nouveauNom)
|
||||||
mach.save()
|
mach.save()
|
||||||
del mach
|
del mach
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
raise e
|
raise e
|
||||||
#return {'error':str(e)}
|
#return {'error':str(e)}
|
||||||
cherrypy.log("Changer nom machine : %s" % nouveauNom, "MESMACHINES")
|
crans.cp.log("Changer nom machine : %s->%s" % (anciennom, nouveauNom), "MESMACHINES")
|
||||||
return {'message':u"Modification réussie", 'mid':mid}
|
return {'message':u"Modification réussie", 'mid':mid}
|
||||||
AJAXChangerNom.exposed = True
|
AJAXChangerNom.exposed = True
|
||||||
|
|
||||||
|
@ -183,12 +184,14 @@ class root:
|
||||||
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
if mach.proprietaire().compte() != cherrypy.session['uid']:
|
||||||
del adh, mach
|
del adh, mach
|
||||||
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
raise Exception(u"L'uid de l'adherent ne correspond mas au proprietaire de la machine.")
|
||||||
|
anciennemac = mach.mac()
|
||||||
|
nommachine = mach.nom()
|
||||||
mach.mac(nouvelleMAC)
|
mach.mac(nouvelleMAC)
|
||||||
mach.save()
|
mach.save()
|
||||||
del mach
|
del mach
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return {'error':e.args[0]}
|
return {'error':e.args[0]}
|
||||||
cherrypy.log("Change mac machine", "MESMACHINES")
|
crans.cp.log("Change mac machine %s : %s->%s" % (nommachine, anciennemac, nouvelleMAC), "MESMACHINES")
|
||||||
return {'message':u"Modification réussie", 'mid':mid}
|
return {'message':u"Modification réussie", 'mid':mid}
|
||||||
AJAXchangerMAC.exposed = True
|
AJAXchangerMAC.exposed = True
|
||||||
|
|
||||||
|
@ -208,7 +211,7 @@ class root:
|
||||||
mach.delete()
|
mach.delete()
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return {'error':e.args[0]}
|
return {'error':e.args[0]}
|
||||||
cherrypy.log("Machine supprimee", "MACHINES")
|
crans.cp.log("Machine supprimee", "MACHINES")
|
||||||
return {'message':u"Machine supprimée"}
|
return {'message':u"Machine supprimée"}
|
||||||
AJAXSupprimerMachine.exposed = True
|
AJAXSupprimerMachine.exposed = True
|
||||||
|
|
||||||
|
@ -234,7 +237,7 @@ class root:
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
del m
|
del m
|
||||||
return {'error':e.args[0].replace("\n","\\n")}
|
return {'error':e.args[0].replace("\n","\\n")}
|
||||||
cherrypy.log("Nouvelle machine %s" % nomNouvelleMachine, "MACHINES")
|
crans.cp.log("Nouvelle machine %s" % nomNouvelleMachine, "MACHINES")
|
||||||
return {'message':u"Machine enregistrée avec succès"}
|
return {'message':u"Machine enregistrée avec succès"}
|
||||||
AJAXCreerMachine.exposed = True
|
AJAXCreerMachine.exposed = True
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import cherrypy, sys, os, datetime
|
import cherrypy, sys, os, datetime
|
||||||
# libraries crans
|
# libraries crans
|
||||||
|
import crans.cp as _crans_cp
|
||||||
sys.path.append('/usr/scripts/gestion/')
|
sys.path.append('/usr/scripts/gestion/')
|
||||||
from config_mail import MailConfig
|
from config_mail import MailConfig
|
||||||
|
|
||||||
|
@ -128,13 +129,13 @@ class monCompte:
|
||||||
def rechargerCompteImpression(self, etape = '1', combien = None):
|
def rechargerCompteImpression(self, etape = '1', combien = None):
|
||||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
|
||||||
if (etape == "1"): # Introduction
|
if (etape == "1"): # Introduction
|
||||||
return {
|
return {
|
||||||
'template' :'MonCompteRechargePaypal1',
|
'template' :'MonCompteRechargePaypal1',
|
||||||
'standalone' :True,
|
'standalone' :True,
|
||||||
'values' :{},
|
'values' :{},
|
||||||
}
|
}
|
||||||
elif (etape == "2"): # choix montant
|
elif (etape == "2"): # choix montant
|
||||||
return {
|
return {
|
||||||
'template' :'MonCompteRechargePaypal2',
|
'template' :'MonCompteRechargePaypal2',
|
||||||
'standalone' :True,
|
'standalone' :True,
|
||||||
'values' :{},
|
'values' :{},
|
||||||
|
@ -228,12 +229,13 @@ class monCompte:
|
||||||
def changeNomAdherent(self, nouveauNom):
|
def changeNomAdherent(self, nouveauNom):
|
||||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
||||||
try:
|
try:
|
||||||
|
ancienNom = adh.nom()
|
||||||
adh.nom(nouveauNom)
|
adh.nom(nouveauNom)
|
||||||
adh.save()
|
adh.save()
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return self.index(error=e.args[0])
|
return self.index(error=e.args[0])
|
||||||
del adh
|
del adh
|
||||||
cherrypy.log("Change nom", "MONCOMPTE ACTION")
|
_crans_cp.log("Change nom : %s -> %s" % (ancienNom, nouveauNom), "MONCOMPTE")
|
||||||
return self.index(message=u'Modification réussie')
|
return self.index(message=u'Modification réussie')
|
||||||
changeNomAdherent.exposed = True
|
changeNomAdherent.exposed = True
|
||||||
|
|
||||||
|
@ -260,7 +262,7 @@ class monCompte:
|
||||||
msg = 'Erreur, mot de passe incorrect'
|
msg = 'Erreur, mot de passe incorrect'
|
||||||
return self.index(error=msg)
|
return self.index(error=msg)
|
||||||
del adh
|
del adh
|
||||||
cherrypy.log("Change password", "MONCOMPTE ACTION")
|
_crans_cp.log("Change password", "MONCOMPTE")
|
||||||
return self.index(message=msg)
|
return self.index(message=msg)
|
||||||
changePasswordAdherent.exposed = True
|
changePasswordAdherent.exposed = True
|
||||||
|
|
||||||
|
@ -271,12 +273,13 @@ class monCompte:
|
||||||
def changePrenomAdherent(self, nouveauPrenom):
|
def changePrenomAdherent(self, nouveauPrenom):
|
||||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
||||||
try:
|
try:
|
||||||
|
ancienPrenom = adh.prenom()
|
||||||
adh.prenom(nouveauPrenom)
|
adh.prenom(nouveauPrenom)
|
||||||
adh.save()
|
adh.save()
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return self.index(error=e.args[0])
|
return self.index(error=e.args[0])
|
||||||
del adh
|
del adh
|
||||||
cherrypy.log("Change prenom", "MONCOMPTE ACTION")
|
_crans_cp.log("Change prenom : %s -> %s" % (ancienPrenom, nouveauPrenom), "MONCOMPTE")
|
||||||
return self.index(message=u'Modification réussie')
|
return self.index(message=u'Modification réussie')
|
||||||
changePrenomAdherent.exposed = True
|
changePrenomAdherent.exposed = True
|
||||||
|
|
||||||
|
@ -286,12 +289,13 @@ class monCompte:
|
||||||
def changeTelAdherent(self, nouveauTel):
|
def changeTelAdherent(self, nouveauTel):
|
||||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'], 'w')['adherent'][0]
|
||||||
try:
|
try:
|
||||||
|
ancienTel = adh.tel()
|
||||||
adh.tel(nouveauTel)
|
adh.tel(nouveauTel)
|
||||||
adh.save()
|
adh.save()
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return self.index(error=e.args[0])
|
return self.index(error=e.args[0])
|
||||||
del adh
|
del adh
|
||||||
cherrypy.log("Change tel", "MONCOMPTE ACTION")
|
_crans_cp.log("Change tel : %s -> %s" % (ancienTel, nouveauTel), "MONCOMPTE")
|
||||||
return self.index(message=u'Modification réussie')
|
return self.index(message=u'Modification réussie')
|
||||||
changeTelAdherent.exposed = True
|
changeTelAdherent.exposed = True
|
||||||
|
|
||||||
|
@ -300,8 +304,8 @@ class monCompte:
|
||||||
##########################
|
##########################
|
||||||
def newAlias(self, alias):
|
def newAlias(self, alias):
|
||||||
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
|
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'],'w')['adherent'][0]
|
||||||
if adh.alias().__len__() >= 3:
|
if adh.alias().__len__() >= 3 and adh.droits() == []:
|
||||||
return self.index(error=u"Vous avez plus de 2 alias. Demander à un câbleur pour en rajouter.")
|
return self.index(error=u"Vous avez plus de 2 alias. Demander a un cableur pour en rajouter.")
|
||||||
try:
|
try:
|
||||||
adh.alias(alias)
|
adh.alias(alias)
|
||||||
adh.save()
|
adh.save()
|
||||||
|
@ -312,7 +316,7 @@ class monCompte:
|
||||||
return self.index(error=u"Vous possèdez déjà cet alias")
|
return self.index(error=u"Vous possèdez déjà cet alias")
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
return self.index(error=u"Vous possèdez déjà cet alias")
|
return self.index(error=u"Vous possèdez déjà cet alias")
|
||||||
cherrypy.log("Nouvel alias", "MONCOMPTE ACTION")
|
_crans_cp.log("Nouvel alias : %s" % alias, "MONCOMPTE")
|
||||||
return self.index(message=u'Alias enregistré')
|
return self.index(message=u'Alias enregistré')
|
||||||
newAlias.exposed = True
|
newAlias.exposed = True
|
||||||
|
|
||||||
|
@ -340,12 +344,12 @@ class monCompte:
|
||||||
adh.contourneGreylist(contourneGreylist)
|
adh.contourneGreylist(contourneGreylist)
|
||||||
adh.rewriteMailHeaders(rewriteMailHeaders)
|
adh.rewriteMailHeaders(rewriteMailHeaders)
|
||||||
adh.save()
|
adh.save()
|
||||||
del adh
|
del adh
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
return self.index(error=e.args[0])
|
return self.index(error=e.args[0])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
return self.index(error=u"Une erreur est survenue lors de lenregistrement. Vérifiez que l'adresse mail fournie est correcte.")
|
return self.index(error=u"Une erreur est survenue lors de lenregistrement. Vérifiez que l'adresse mail fournie est correcte.")
|
||||||
cherrypy.log("Change mail prefs", "MONCOMPTE ACTION")
|
_crans_cp.log("Change mail prefs", "MONCOMPTE ACTION")
|
||||||
return self.index(message=u'Vos préférences ont été enregistrées')
|
return self.index(message=u'Vos préférences ont été enregistrées')
|
||||||
saveMailPrefs.exposed = True
|
saveMailPrefs.exposed = True
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue