aboutsummaryrefslogtreecommitdiff
path: root/affiche-liste.py
blob: 9d7411d9f8423f0522e7b0ebddbef2081f52bd70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python
# -*- coding: utf-8 -*-

from mod_python import Session
from fonctions import redirectionSiNonConnecte, lien, codeHTML, connexionBD

def index(req):
    req.content_type="text/html"

    sess = Session.Session(req)
    redirectionSiNonConnecte(req,sess)
    id_util=sess["id_util"]
    nom=req.form["nom"]
    conn = connexionBD()
    cur = conn.cursor()

    sql = "select id_contact, nom from contact where id_util={} and nom like '%{}%';".format(id_util, nom)
    cur.execute(sql)
    conn.commit()
    data = cur.fetchall()
    conn.close()

    for i in data:
	req.write("""<ul><li>""" + lien('fiche.py?id_contact=' + str(i[0]), str(i[1])) + """</li></ul>""")