aboutsummaryrefslogtreecommitdiff
path: root/www/html/index.py
blob: 010ed2dcd8744eec02ee073d222aa3a4a79487af (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import mod_python
from fonctions import baseHTML, connexionBD

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

#sql part    
    conn=connexionBD()
    cur=conn.cursor()
    sql="select * from trame;"
    cur.execute(sql)
    conn.commit()
    data=cur.fetchall()
    conn.close()
#sql part

    for i in data :
        content+=("""<tr>""" + 
"""<td>""" + str(i[1]) + """</td>""" +
"""<td>""" + str(i[2]) + """</td>""" +
"""<td>""" + str(i[3]) + """</td>""" +
"""<td>""" + str(i[4]) + """</td>""" +
"""</tr>""")
    
    req.write(baseHTML("ATS-Project","""
<center><h1>ATS-Project</h1></center>
<table>
<tr><th>Heure</th><th>Protocole</th><th>Source</th><th>Destination</th></tr>
"""
+ content + 
"""
</table>
""")) #tableheads to change so it takes the output of the select