aboutsummaryrefslogtreecommitdiff
path: root/fonctions.py
diff options
context:
space:
mode:
Diffstat (limited to 'fonctions.py')
-rw-r--r--fonctions.py31
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")