[intranet] suppression des trailing whitespaces qui gênent la lecture
darcs-hash:20090128153306-bd074-4a8923921ada6494c88bee3a177042f771249f1b.gz
This commit is contained in:
parent
636e75038f
commit
0abe5fb17f
3 changed files with 83 additions and 84 deletions
|
@ -1,28 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# #############################################################
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# ..
|
||||
# .... ............ ........
|
||||
# . ....... . .... ..
|
||||
# . ... .. .. .. .. ..... . ..
|
||||
# .. .. ....@@@. .. . ........ .
|
||||
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
|
||||
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
|
||||
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
|
||||
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
|
||||
# ...@@@.... @@@ .@@.......... ........ ..... ..
|
||||
# . ..@@@@.. . .@@@@. .. ....... . .............
|
||||
# . .. .... .. .. . ... ....
|
||||
# . . .... ............. .. ...
|
||||
# .. .. ... ........ ... ...
|
||||
# ................................
|
||||
#
|
||||
# #############################################################
|
||||
# Intranet.py
|
||||
#
|
||||
# Intranet.py
|
||||
#
|
||||
# Classe Intranet, clase de base de l'intranet
|
||||
#
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
#
|
||||
# Copyright (c) 2006 by www.crans.org
|
||||
# #############################################################
|
||||
import crans.cp as _crans_cp
|
||||
import cherrypy, os, sys
|
||||
|
@ -35,7 +35,7 @@ class Intranet:
|
|||
# ######################################################## #
|
||||
# GESTION DES MODULES #
|
||||
# ######################################################## #
|
||||
#
|
||||
#
|
||||
#
|
||||
_loaded_modules = {}
|
||||
|
||||
|
@ -53,7 +53,7 @@ class Intranet:
|
|||
# import n'aime pas les chemins absolus !!
|
||||
mon_module = __import__(module_path)
|
||||
module_root = mon_module.main()
|
||||
# on ajoute la classe a l'arborescence de cherrypy :
|
||||
# on ajoute la classe a l'arborescence de cherrypy :
|
||||
setattr( self, un_module, module_root)
|
||||
try:
|
||||
# on ajoute le module aux modules connus
|
||||
|
@ -74,20 +74,20 @@ class Intranet:
|
|||
# ajouter le dossier static ou il faut
|
||||
staticPath = make_path(MODULES_DIR, un_module, "static")
|
||||
if os.path.isdir(staticPath):
|
||||
settings= { self._make_static_path_for_module(un_module):
|
||||
settings= { self._make_static_path_for_module(un_module):
|
||||
{ 'sessionAuthenticateFilter.on': False,
|
||||
'sessionFilter.on': False,
|
||||
'server.output_filters.templatesEngine.on' : False,
|
||||
'staticFilter.on': True,
|
||||
'staticFilter.dir': staticPath,
|
||||
}
|
||||
}
|
||||
}
|
||||
cherrypy.config.update(settings)
|
||||
if cherrypy.config.get("server.environment") == "development":
|
||||
_crans_cp.log("New static : %s" % staticPath)
|
||||
# fin de l'ajout du dossier static
|
||||
_crans_cp.log("New static : %s" % staticPath)
|
||||
# fin de l'ajout du dossier static
|
||||
|
||||
|
||||
|
||||
def __init__(self):
|
||||
##
|
||||
#### import automatique des modules
|
||||
|
@ -105,11 +105,11 @@ class Intranet:
|
|||
else:
|
||||
_crans_cp.log("Pas de dossier de modules", 'LOADING', 2)
|
||||
|
||||
|
||||
|
||||
# ######################################################## #
|
||||
# QUELQUES PAGES #
|
||||
# ######################################################## #
|
||||
#
|
||||
#
|
||||
#
|
||||
def index(self):
|
||||
items = {}
|
||||
|
@ -125,14 +125,14 @@ class Intranet:
|
|||
# si la categorie est vide, on la vire
|
||||
if items[a_category] == {}:
|
||||
del items[a_category]
|
||||
|
||||
|
||||
return {
|
||||
'template':'accueil',
|
||||
'values':{"modules":items},
|
||||
'stylesheets':['css/accueil.css'],
|
||||
}
|
||||
index.exposed= True
|
||||
|
||||
|
||||
def info(self):
|
||||
return {
|
||||
'template':'info-diverses',
|
||||
|
@ -147,7 +147,7 @@ class Intranet:
|
|||
exp = "intranet"
|
||||
dest = cherrypy.config.get("mail.bugreport", "nounous@crans.org")
|
||||
subject = "Rapport de Bug"
|
||||
|
||||
|
||||
# corps du mail
|
||||
text = """
|
||||
Bonsoir,
|
||||
|
@ -155,7 +155,7 @@ Bonsoir,
|
|||
Ceci est un rapport de bug envoye par l'intranet.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
# on recupere tout de suite le traceback
|
||||
tb = crans.utils.exceptions.formatExc()
|
||||
text += "\n= Traceback =\n"
|
||||
|
@ -164,12 +164,12 @@ Ceci est un rapport de bug envoye par l'intranet.
|
|||
errorString = tb.split("\n")[-2]
|
||||
subject = "[Error] %s" % errorString
|
||||
except: pass
|
||||
|
||||
|
||||
text +="\n= Autres informations =\n"
|
||||
autres_informations = "\n".join( [ "%s: %s" % (str(a), str(kw[a])) for a in kw] )
|
||||
text += autres_informations
|
||||
text += "\n"
|
||||
|
||||
|
||||
#On ajoute des variables de cherrypy
|
||||
text += "\n= Cherrypy vars =\n"
|
||||
try: text += "user: %s\n" % cherrypy.session['uid']
|
||||
|
@ -188,18 +188,18 @@ Ceci est un rapport de bug envoye par l'intranet.
|
|||
text += "path: %s\n" % cherrypy.request.path
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
#on signe, quand meme !
|
||||
text += "\n-- \nRoot.py pour l'intranet\n"
|
||||
|
||||
text += "\n-- \nRoot.py pour l'intranet\n"
|
||||
|
||||
quickSend(exp, dest, subject, text)
|
||||
return self.index()
|
||||
|
||||
|
||||
send_error_repport.exposed = True
|
||||
|
||||
|
||||
def testErreur(self):
|
||||
raise Exception, "Fausse alerte ! (test du systèmede gestion des erreurs)"
|
||||
|
||||
|
||||
testErreur.exposed = True
|
||||
|
||||
def _cp_on_http_error(self, status, message):
|
||||
|
@ -212,13 +212,13 @@ Ceci est un rapport de bug envoye par l'intranet.
|
|||
if status==403:
|
||||
cherrypy.response.body = {
|
||||
'template':'error403',
|
||||
'values':{'status':status, 'message':message },
|
||||
'values':{'status':status, 'message':message },
|
||||
'standalone':False,
|
||||
}
|
||||
elif status==404:
|
||||
cherrypy.response.body = {
|
||||
'template':'error',
|
||||
'values':{'status':status, 'message':message },
|
||||
'values':{'status':status, 'message':message },
|
||||
'standalone':False,
|
||||
}
|
||||
elif status==500:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# Description:
|
||||
# Permet de chercher dans les facture, d'en créditer et d'en supprimer
|
||||
# Informations:
|
||||
#
|
||||
#
|
||||
# Pages:
|
||||
# index:afiche le formulaire et les factures
|
||||
#
|
||||
|
@ -32,11 +32,11 @@ class main(ModuleBase):
|
|||
cherrypy.session['gestion_factures-current_search'] = {
|
||||
"fid":fid,
|
||||
"uid":uid,
|
||||
"aid":aid,
|
||||
"aid":aid,
|
||||
}
|
||||
return self.displayTemplate()
|
||||
search.exposed = True
|
||||
|
||||
|
||||
|
||||
|
||||
def displayTemplate(self, message = '', erreur = ''):
|
||||
|
@ -52,7 +52,7 @@ class main(ModuleBase):
|
|||
uid = uid,
|
||||
aid = aid,
|
||||
)
|
||||
|
||||
|
||||
else:
|
||||
fid = ""
|
||||
uid = ""
|
||||
|
@ -63,7 +63,7 @@ class main(ModuleBase):
|
|||
t["form"]+= [{'name':'aid', 'label':'aid', 'value':aid}]
|
||||
|
||||
return {
|
||||
'template' :'factures-gestion',
|
||||
'template' :'factures-gestion',
|
||||
'values' :t,
|
||||
'stylesheets' :['cransFactures.css'],
|
||||
}
|
||||
|
@ -96,19 +96,19 @@ class main(ModuleBase):
|
|||
facture = {}
|
||||
facture['no'] = f.numero()
|
||||
facture['adherent'] = f.proprietaire().mail()
|
||||
facture['montant'] = f.total()
|
||||
facture['montant'] = f.total()
|
||||
facture['payee'] = f.recuPaiement()
|
||||
facture['datetime'] = datetime.datetime.strptime (f.historique()[0].split(',')[0], '%d/%m/%Y %H:%M')
|
||||
facture['date'] = f.historique()[0].split(',')[0]
|
||||
facture['url'] = f.urlPaypal()
|
||||
facture['intitule'] = f.articles()[0]['designation']
|
||||
facture['details'] = [
|
||||
{
|
||||
{
|
||||
'intitule':art['designation'],
|
||||
'quantite':art['nombre'],
|
||||
'prixUnitaire':art['pu'],
|
||||
'prixTotal':art['pu']*art['nombre'],
|
||||
} for art in f.articles()]
|
||||
} for art in f.articles()]
|
||||
liste_factures_affichees.append(facture)
|
||||
except:
|
||||
crans.cp.log("Facture non affichable : fid=%s" % str(f.numero()), "GESTION FACTURES", 1)
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#! /usr/bin/env python
|
||||
# -*- coding: iso-8859-15 -*-
|
||||
# ##################################################################################################### #
|
||||
# ########################################################################
|
||||
# Mes Sous
|
||||
# ##################################################################################################### #
|
||||
# ########################################################################
|
||||
# Description:
|
||||
# Affiche la liste des factures et l'historique de debits/credits de l'adherent.
|
||||
# Fait aussi les rechargements Paypal
|
||||
# Affiche la liste des factures et l'historique de debits/credits de
|
||||
# l'adherent. Fait aussi les rechargements Paypal
|
||||
# Informations:
|
||||
#
|
||||
#
|
||||
# Pages:
|
||||
# index:liste des factures
|
||||
# historique: historique des débits/crédits
|
||||
# rechargementPaypal: Comme son nom l'indique
|
||||
#
|
||||
# ##################################################################################################### #
|
||||
# ########################################################################
|
||||
import cherrypy, sys, os, datetime
|
||||
|
||||
|
||||
|
@ -35,11 +35,9 @@ class main(ModuleBase):
|
|||
return "Personnel"
|
||||
def icon(self):
|
||||
return "icon.png"
|
||||
|
||||
_club = True
|
||||
|
||||
|
||||
|
||||
def getCurrentAdministrativeYear(self):
|
||||
'''
|
||||
premiere partie de l''annee scolaire en cours
|
||||
|
@ -61,7 +59,7 @@ class main(ModuleBase):
|
|||
t['message'] = message
|
||||
t['error'] = error
|
||||
t['solde'] = adh.solde
|
||||
|
||||
|
||||
############## liste des factures ##############
|
||||
listeFactures = []
|
||||
for f in adh.factures():
|
||||
|
@ -76,18 +74,20 @@ class main(ModuleBase):
|
|||
'prixTotal':art['pu']*art['nombre'],
|
||||
} for art in f.articles()]
|
||||
facture['montant'] = f.total()
|
||||
facture['paypal'] = f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False),
|
||||
facture['paypal'] = f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False),
|
||||
|
||||
businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"),
|
||||
return_page = "https://intranet.crans.org/monCompte/paypalReturn",
|
||||
cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel",
|
||||
)
|
||||
|
||||
|
||||
facture['payee'] = f.recuPaiement()
|
||||
listeFactures.append(facture)
|
||||
t['listeFactures'] = listeFactures
|
||||
|
||||
return {
|
||||
'template' :'factures',
|
||||
'template' :'factures',
|
||||
|
||||
'values' :t,
|
||||
'stylesheets' :['cransFactures.css'],
|
||||
'scripts' :[],
|
||||
|
@ -96,7 +96,6 @@ class main(ModuleBase):
|
|||
|
||||
def historique(self, page = 1, items_per_page = 20):
|
||||
adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
|
||||
|
||||
lst = [ x for x in adh.historique() if x.split(u' : ',1)[1].startswith(u'credit') or x.split(u' : ',1)[1].startswith(u'debit') ]
|
||||
histLst = []
|
||||
for anItem in lst:
|
||||
|
@ -109,7 +108,7 @@ class main(ModuleBase):
|
|||
except Exception:
|
||||
aLine["intitule"] = ""
|
||||
histLst.append(aLine)
|
||||
|
||||
|
||||
histLst.reverse()
|
||||
page = int(page)
|
||||
items_per_page = int(items_per_page)
|
||||
|
@ -117,20 +116,20 @@ class main(ModuleBase):
|
|||
prevPage = None
|
||||
else:
|
||||
prevPage = page - 1
|
||||
|
||||
|
||||
if page * items_per_page >= histLst.__len__():
|
||||
nextPage = None
|
||||
nextPage = None
|
||||
else:
|
||||
nextPage = page + 1
|
||||
offset = items_per_page * ( page - 1)
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
'template' :'factures-historique',
|
||||
'template' :'factures-historique',
|
||||
'values' :{
|
||||
'liste':lst,
|
||||
'historic_items':histLst[offset:offset + items_per_page],
|
||||
'nextPage':nextPage,
|
||||
'historic_items':histLst[offset:offset + items_per_page],
|
||||
'nextPage':nextPage,
|
||||
'prevPage':prevPage
|
||||
},
|
||||
'stylesheets' :['cransFactures.css'],
|
||||
|
@ -152,11 +151,11 @@ class main(ModuleBase):
|
|||
return self.index()
|
||||
delFacture.exposed = True
|
||||
|
||||
|
||||
|
||||
##########################
|
||||
# paypal
|
||||
##########################
|
||||
#
|
||||
#
|
||||
# methode qui affiche successivement les
|
||||
# templates du popup pour recharger son compte impression
|
||||
# via paypal
|
||||
|
@ -165,13 +164,13 @@ class main(ModuleBase):
|
|||
adh = cherrypy.session['LDAP'].getProprio(cherrypy.session['uid'])
|
||||
if (etape == "1"): # Introduction
|
||||
return {
|
||||
'template' :'MonCompteRechargePaypal1',
|
||||
'template' :'MonCompteRechargePaypal1',
|
||||
'standalone' :True,
|
||||
'values' :{},
|
||||
}
|
||||
elif (etape == "2"): # choix montant
|
||||
return {
|
||||
'template' :'MonCompteRechargePaypal2',
|
||||
'template' :'MonCompteRechargePaypal2',
|
||||
'standalone' :True,
|
||||
'values' :{},
|
||||
}
|
||||
|
@ -186,14 +185,14 @@ class main(ModuleBase):
|
|||
combien = combien.replace(u',', u'.')
|
||||
# convertissage
|
||||
combien = float(combien)
|
||||
# arrondissage-tronquage :
|
||||
# arrondissage-tronquage :
|
||||
combien = float(int(combien*100)/100.0)
|
||||
# nombre positif
|
||||
if combien < 0:
|
||||
raise ValueError
|
||||
except Exception:
|
||||
return {
|
||||
'template' :'MonCompteRechargePaypal2',
|
||||
'template' :'MonCompteRechargePaypal2',
|
||||
'standalone' :True,
|
||||
'values' :{'error':"Le montant doit être un nombre positif !", 'combien':combien},
|
||||
}
|
||||
|
@ -209,7 +208,7 @@ class main(ModuleBase):
|
|||
} for art in f.articles()]
|
||||
pageData['total'] = f.total()
|
||||
return {
|
||||
'template' :'MonCompteRechargePaypal3',
|
||||
'template' :'MonCompteRechargePaypal3',
|
||||
'standalone' :True,
|
||||
'values' :pageData,
|
||||
}
|
||||
|
@ -218,20 +217,20 @@ class main(ModuleBase):
|
|||
f = cherrypy.session['freshFacture']
|
||||
f.save()
|
||||
return {
|
||||
'template' :'MonCompteRechargePaypal4',
|
||||
'template' :'MonCompteRechargePaypal4',
|
||||
'standalone' :True,
|
||||
'values' :{'lienPaypal' : f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False),
|
||||
'values' :{'lienPaypal' : f.urlPaypal(useSandbox = cherrypy.config.get("paypal.useSandbox", False),
|
||||
businessMail = cherrypy.config.get("paypal.businessAdress", "paypal@crans.org"),
|
||||
return_page = "https://intranet.crans.org/monCompte/paypalReturn",
|
||||
cancel_return_page = "https://intranet.crans.org/monCompte/paypalCancel",
|
||||
)},
|
||||
}
|
||||
rechargerCompteImpression.exposed = True
|
||||
|
||||
|
||||
def paypalReturn(self, **kw):
|
||||
_crans_cp.log("retour de paypal avec les infos : %s" % " ".join( [ "[%s: %s]" % (str(a), str(kw[a])) for a in kw] ) )
|
||||
return {
|
||||
'template' :'MonComptePaypalReturn',
|
||||
'template' :'MonComptePaypalReturn',
|
||||
'standalone' :True,
|
||||
'values' :{},
|
||||
}
|
||||
|
@ -240,7 +239,7 @@ class main(ModuleBase):
|
|||
def paypalCancel(self, **kw):
|
||||
_crans_cp.log("annulation de paypal avec les infos : %s" % " ".join( [ "[%s: %s]" % (str(a), str(kw[a])) for a in kw] ) )
|
||||
return {
|
||||
'template' :'MonComptePaypalCancel',
|
||||
'template' :'MonComptePaypalCancel',
|
||||
'standalone' :True,
|
||||
'values' :{},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue