From 77bf9f314745a0ea56a6d10f1162ddf5795b555c Mon Sep 17 00:00:00 2001 From: guimoz Date: Mon, 30 Jan 2017 00:05:29 +0100 Subject: [PATCH] Ajout de l'etat --- roulette.py | 13 ++++++++++--- state | 1 + templates/precampagne.html | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 state diff --git a/roulette.py b/roulette.py index 79d7281..38fa42c 100644 --- a/roulette.py +++ b/roulette.py @@ -16,6 +16,7 @@ DEBUG = True SECRET_KEY = "\xf3'\xd2\xf7\xa4[.h\x8e\x11|\xda\x00\x9fyS\xfe\xb3(!\x91'6\x16" USERNAME = 'admin' PASSWORD = 'pipo' +ASSHOLES = [] SQLITE_FILENAME = '/var/roulette/players.db' SQLITE_SCHEMA = 'schema.sql' @@ -31,7 +32,7 @@ IMMUNITY_FILE = '/var/roulette/immunity' ASSHOLES_FILE = '/var/roulette/assholes' STATE_FILE = '/var/roulette/state' -STATE = 'precampagne' +STATE = 'down' app = Flask(__name__) app.config.from_object(__name__) @@ -305,7 +306,11 @@ def banned(): def banned_ip(): #Actualisation de l'etat de la roulette with open(STATE_FILE, 'r') as f: + global STATE STATE = f.read() + if DEBUG : + print(STATE) + # Liste des ip pour récupération par babel et plop if not DEBUG: if get_ip() not in ['10.7.0.254']: @@ -327,9 +332,11 @@ def banned_ip(): @playable_required def home(): player = get_player_from_ip(get_ip()) - if STATE == "down": + if DEBUG: + print(STATE) + if "down" in STATE: return render_template('down.html', user=player) - elif STATE == "launched": + elif "up" in STATE: if DEBUG: print(player, 'arrived') diff --git a/state b/state new file mode 100644 index 0000000..07152fc --- /dev/null +++ b/state @@ -0,0 +1 @@ +precampagne diff --git a/templates/precampagne.html b/templates/precampagne.html index 4d6d94d..646911d 100644 --- a/templates/precampagne.html +++ b/templates/precampagne.html @@ -2,7 +2,6 @@ {% block content %}

Pas de précampagne!

- Reviens bientôt {{ user['firstname']+' '+user['name'] }} pour jouer à la rezo-roulette + Reviens plus tard {{ user['firstname']+' '+user['name'] }} pour jouer à la rezo-roulette

-{% endif %} {% endblock %}