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