passage à mysqlclient

This commit is contained in:
2018-11-17 14:52:53 +01:00
parent 27ef92edb6
commit 3bd19138e1
9 changed files with 13 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ SQLAlchemy
transaction
zope.sqlalchemy
waitress
MySQL-python
mysqlclient
python-dateutil
docutils

View File

@@ -1,7 +1,7 @@
# -*- coding: utf8 -*-
from pyramid_layout.layout import layout_config
from .security import groupfinder
from views.default import (
from .views.default import (
to_euro,
to_percent,
to_decimal,

View File

@@ -26,7 +26,7 @@ def get_member_by_mdp_oublie(request, lien):
def get_member_by_id(request, mbr_id):
if mbr_id == '0':
query = "SELECT * FROM P_USERS ORDER BY cd_uti"
query = "SELECT * FROM p_users ORDER BY cd_uti"
results = request.dbsession.execute(query).fetchall()
else:
# lire le membres par son identifianr

View File

@@ -113,7 +113,7 @@
</td>
<td>
<span tal:condition="detail.rdv_debut==None"></span>
<span tal:condition="detail.rdv_debut<>None">
<span tal:condition="detail.rdv_debut!=None">
<a href="${request.route_url('rdv_edit', nodossier=nodossier, nolig=detail.NOLIG)}">
${detail.rdv_debut.strftime('%d/%m/%Y %H:%M')}</a>
avec ${detail.LISTE}

View File

@@ -86,7 +86,7 @@
<button class="btn btn-primary" type="submit" name="form.submitted">
<span class="glyphicon glyphicon-ok"></span> Enregistrer</button>
<button class="btn btn-warning" type="submit" name="form.deleted"
tal:condition="individu.CD_UTI > 0">
tal:condition="individu.CD_UTI != '0'">
<span class="glyphicon glyphicon-remove"></span> Supprimer</button>
</div>
</div>

View File

@@ -37,6 +37,9 @@ def to_euro(x):
#else:
return (u"%.2f" % x).replace('.', ',')
def to_sha1(message):
return hashlib.sha1(message.encode('utf-8')).hexdigest()
def to_int(x):
try:
number = int(x.replace(',', '.'))
@@ -100,7 +103,7 @@ def changer_mdp(request):
if 'form.submitted' in request.params:
old_password = request.params['old_password']
new_password = request.params['new_password1']
if member.mdp == hashlib.sha1(old_password).hexdigest():
if member.mdp == to_sha1(password):
update_membre_mdp(request, logged_in, new_password)
request.session.flash(u"Votre mot de passe a été mis à jour avec succès.")
return HTTPFound(location=request.route_url('home'))
@@ -162,7 +165,7 @@ def login(request):
record = get_member_by_id(request, login)
if record :
# mot de passe hash valide ?
if record.mdp == hashlib.sha1(password).hexdigest():
if record.mdp == to_sha1(password):
update_last_connection(request, login)
# force le commit car il ne se fait pas automatiquement après l'update
transaction.commit()

View File

@@ -77,7 +77,7 @@ def user_edit(request):
if cd_uti == '0':
# nouveau
individu = {}
individu['cd_uti'] = 0
individu['cd_uti'] = '0'
individu['nom'] = ''
individu['email'] = ''
individu['access'] = '0 | Production'

View File

@@ -19,6 +19,7 @@ pyramid.includes =
pyramid_exclog
sqlalchemy.url = mysql://root:cni/@srvbd/bddevfac?charset=utf8
sqlalchemy.pool_recycle = 3600
mondumas.admin_email = phuoc@caotek.fr

View File

@@ -20,7 +20,7 @@ requires = [
'transaction',
'zope.sqlalchemy',
'waitress',
'MySQL-python',
'mysqlclient',
'python-dateutil',
'docutils',
]