From 2b20eb9a0daa644807bf8e23262f7fe528b06de5 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 29 Jan 2017 17:00:21 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20de=20l'immunit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ immunity | 6 ------ roulette.py | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 immunity diff --git a/.gitignore b/.gitignore index dc351da..95612bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ players.db +immunity + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/immunity b/immunity deleted file mode 100644 index dfe4b59..0000000 --- a/immunity +++ /dev/null @@ -1,6 +0,0 @@ -Goulven Kermarec -Lazare Olivry -Brieuc Lacroix -Cyriaque Millot -Juliette Tibayrenc -Siqi Liu diff --git a/roulette.py b/roulette.py index 0257d3b..86a15eb 100644 --- a/roulette.py +++ b/roulette.py @@ -27,7 +27,7 @@ MYSQL_DB = 'rezo_admin' BAN_DURATION = 30. * 60. -IMMUNITY_FILE = '/var/www/roulette/immunity' +IMMUNITY_FILE = '/var/roulette/immunity' ASSHOLES_FILE = '/var/www/roulette/assholes' IMMUNITY = [ @@ -143,6 +143,7 @@ def get_player_from_ip(ip): row = cur.fetchone() con.close() + print("last good line") user = None if row is not None: user = {'id': row[0], 'firstname': row[1], 'name': row[2], \ @@ -208,15 +209,14 @@ def get_players_not_banned(): con.close() not_banned = [{'id': row[0], 'firstname': row[1], 'name': row[2]} for row in rows] - + # Ensuite on applique les règles d'immunité with open(IMMUNITY_FILE, 'r') as f: immunity = f.read() result = [] for user in not_banned: - if user['firstname']+' '+usr['name'] not in immunity: + if user['firstname']+' '+user['name'] not in immunity: result.append(user) - return result def cheat(player_id, target_id):