aboutsummaryrefslogtreecommitdiff
path: root/www/html/fonctions.py
blob: c9c3df2b13ce637888e808dc61f0192d23063b59 (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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import psycopg2

def baseHTML(title,body):
    content=("""<!DOCTYPE html>
<html lang="fr">
        <head>
                <title>"""+ title +"""</title>
                <meta charset="UTF-8">
                <link rel="stylesheet" type="text/css" href="/style.css">
        </head>
        <body>
            <nav>
                <a href="/">Index</a>
                <a href="/filtrage.py">Filtrage</a>
                <a href="/syntaxe.py">Syntaxe</a>
                <a href="/analyse.py">Analyse</a>
            </nav>
        """+ body +"""</body>
</html>

            """)
    return content


def connexionBD():
    connexion=psycopg2.connect ("host='localhost' dbname='atsdb' user='atsuser' password='123456'")
    return connexion

def lien(url,texte):
    content=("""<a href=" """ + url + """ ">""" + texte + """</a>""")
    return content