diff options
| author | Clyhtsuriva Synck <clyhtsuriva> | 2020-03-01 15:14:15 +0100 |
|---|---|---|
| committer | Clyhtsuriva Synck <clyhtsuriva> | 2020-03-01 15:14:15 +0100 |
| commit | 703c1c623892d69d8e24af68b31d84495301ca02 (patch) | |
| tree | 743b32ed4cc4a5d597b4fbc5726e0c3e52bf7c7b /fonctions.py | |
| parent | f33d24f47fa9d39e687d55cff1de9b4cc4ceb033 (diff) | |
| download | dynamicWebsite-Project-703c1c623892d69d8e24af68b31d84495301ca02.tar.gz dynamicWebsite-Project-703c1c623892d69d8e24af68b31d84495301ca02.tar.bz2 dynamicWebsite-Project-703c1c623892d69d8e24af68b31d84495301ca02.zip | |
initial files
Diffstat (limited to '')
| -rw-r--r-- | fonctions.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/fonctions.py b/fonctions.py new file mode 100644 index 0000000..f227b0c --- /dev/null +++ b/fonctions.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import psycopg2 +import mod_python + +def codeHTML(titre, corps): + content=("""<!DOCTYPE html> +<html> + <head> + <title>""" + titre + """</title> + <meta charset="UTF-8"> + <link rel="stylesheet" type="text/css" href="style.css"> + </head> + <body>""" + corps + """</body> +</html>""") + + return content + +def connexionBD(): +# connexion=psycopg2.connect ("host='aquabdd' dbname='etudiants' user='11802407' password='153067690FG'") + connexion=psycopg2.connect ("host='localhost' dbname='devweb' user='devweb' password='123456'") + return connexion + +def lien(url, texte): + content=("""<a href=" """ + url + """ ">""" + texte + """</a>""") + return content + +def redirectionSiNonConnecte(req,sess): + if sess.is_new(): + mod_python.util.redirect(req, "form-connexion.py") |
