From c2048f9259a9876bd2c231e3a0443e295f55c915 Mon Sep 17 00:00:00 2001 From: Ilya Zverev Date: Sat, 4 Feb 2017 23:01:42 +0100 Subject: [PATCH] Better framework for banning --- mmwatch/config.py | 1 + mmwatch/server/mapsme_process.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mmwatch/config.py b/mmwatch/config.py index 90c4bda..52fa392 100644 --- a/mmwatch/config.py +++ b/mmwatch/config.py @@ -8,6 +8,7 @@ DATABASE_URI = 'sqlite:///' + os.path.join(BASE_DIR, 'server', 'mapsme-changes.d PAGE_SIZE = 100 TOP = 10 +BAN_USERS = set([481934]) # See https://github.com/Zverik/queryat # Example: 'http://localhost:5000/queryat/' diff --git a/mmwatch/server/mapsme_process.py b/mmwatch/server/mapsme_process.py index b74149b..c899ef2 100644 --- a/mmwatch/server/mapsme_process.py +++ b/mmwatch/server/mapsme_process.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import urllib2, re, gzip, json +import config from db import * from lxml import etree from StringIO import StringIO @@ -26,7 +27,7 @@ def download_last_state(): def filter_changeset(changeset): """A changeset object is a dict of tags plus 'id', 'timestamp' and 'user' fields.""" - if changeset['uid'] == 481934: # Ban iWowik + if changeset['uid'] in config.BAN_USERS: return False return 'created_by' in changeset and changeset['created_by'][:7] == 'MAPS.ME' and 'JOSM' not in changeset['created_by']