[annuaires_pg] Évite de tout planter quand la connexion à PgSQL chie
darcs-hash:20100907125040-ffbb2-efe3bdf518a51a2e2aa6c8d623d76954682b0b22.gz
This commit is contained in:
parent
36bb207274
commit
c64c89ddd3
1 changed files with 10 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
|
try:
|
||||||
conn = psycopg2.connect("user=crans dbname=switchs host=pgsql.adm.crans.org")
|
conn = psycopg2.connect("user=crans dbname=switchs host=pgsql.adm.crans.org")
|
||||||
|
|
||||||
# Population de la tâble avec les bâtiments
|
# Population de la tâble avec les bâtiments
|
||||||
|
@ -10,6 +11,10 @@ cur = conn.cursor()
|
||||||
|
|
||||||
cur.execute("SELECT DISTINCT batiment FROM prises")
|
cur.execute("SELECT DISTINCT batiment FROM prises")
|
||||||
bat_switchs = [i[0] for i in cur.fetchall()]
|
bat_switchs = [i[0] for i in cur.fetchall()]
|
||||||
|
except psycopg2.OperationalError:
|
||||||
|
bat_switchs = ["a", "b", "c", "g", "h", "i", "j", "m", "o", "p"]
|
||||||
|
|
||||||
|
|
||||||
bat_manuels = []
|
bat_manuels = []
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue