Quand on veut qu'une variable globale soit lisible dans une fonction, faut faire gaffe...
* ~100 mails sur une dizaine d'adhérents plus loin...
This commit is contained in:
parent
9c472f97c0
commit
3041a8ee16
1 changed files with 23 additions and 23 deletions
|
@ -30,6 +30,29 @@ import gestion.mail as mail_module
|
||||||
# Ça printe au lieu de faire bobo quand c'est à True
|
# Ça printe au lieu de faire bobo quand c'est à True
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
|
LDAP = shortcuts.lc_ldap_admin()
|
||||||
|
|
||||||
|
# Connection à la base sql via pgsql
|
||||||
|
PGSQL = psycopg2.connect(database='filtrage', user='crans')
|
||||||
|
PGSQL.set_session(autocommit=True)
|
||||||
|
CURSEUR = PGSQL.cursor(cursor_factory=psycopg2.extras.DictCursor)
|
||||||
|
|
||||||
|
# Avertis upload hard
|
||||||
|
REQUETE = "SELECT type, id FROM avertis_upload_hard WHERE date > now() - %(interval)s;"
|
||||||
|
CURSEUR.execute(REQUETE, {
|
||||||
|
'interval': DELTA,
|
||||||
|
})
|
||||||
|
|
||||||
|
AVERTIS_UPLOAD_HARD = CURSEUR.fetchall()
|
||||||
|
|
||||||
|
# Avertis upload soft
|
||||||
|
REQUETE = "SELECT type, id FROM avertis_upload_soft WHERE date > now() - %(interval)s"
|
||||||
|
CURSEUR.execute(REQUETE, {
|
||||||
|
'interval': DELTA,
|
||||||
|
})
|
||||||
|
|
||||||
|
AVERTIS_UPLOAD_SOFT = CURSEUR.fetchall()
|
||||||
|
|
||||||
EPOCH = pytz.utc.localize(datetime.datetime(1970, 1, 1))
|
EPOCH = pytz.utc.localize(datetime.datetime(1970, 1, 1))
|
||||||
TZ = pytz.timezone('Europe/Paris')
|
TZ = pytz.timezone('Europe/Paris')
|
||||||
DELTA = datetime.timedelta(0, upload.interval * 3600, 0)
|
DELTA = datetime.timedelta(0, upload.interval * 3600, 0)
|
||||||
|
@ -473,27 +496,4 @@ def reperage_chambre(mac):
|
||||||
return "Inconnue", "Inconnue"
|
return "Inconnue", "Inconnue"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
LDAP = shortcuts.lc_ldap_admin()
|
|
||||||
|
|
||||||
# Connection à la base sql via pgsql
|
|
||||||
PGSQL = psycopg2.connect(database='filtrage', user='crans')
|
|
||||||
PGSQL.set_session(autocommit=True)
|
|
||||||
CURSEUR = PGSQL.cursor(cursor_factory=psycopg2.extras.DictCursor)
|
|
||||||
|
|
||||||
# Avertis upload hard
|
|
||||||
REQUETE = "SELECT type, id FROM avertis_upload_hard WHERE date > now() - %(interval)s;"
|
|
||||||
CURSEUR.execute(REQUETE, {
|
|
||||||
'interval': DELTA,
|
|
||||||
})
|
|
||||||
|
|
||||||
AVERTIS_UPLOAD_HARD = CURSEUR.fetchall()
|
|
||||||
|
|
||||||
# Avertis upload soft
|
|
||||||
REQUETE = "SELECT type, id FROM avertis_upload_soft WHERE date > now() - %(interval)s"
|
|
||||||
CURSEUR.execute(REQUETE, {
|
|
||||||
'interval': DELTA,
|
|
||||||
})
|
|
||||||
|
|
||||||
AVERTIS_UPLOAD_SOFT = CURSEUR.fetchall()
|
|
||||||
|
|
||||||
main(CURSEUR, LDAP)
|
main(CURSEUR, LDAP)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue