From e11669559b14dfb14b40bb0a8cafb2f62dc268eb Mon Sep 17 00:00:00 2001 From: neptune Date: Mon, 21 Feb 2022 18:24:37 -0300 Subject: Arreglada eliminación de múltiples posts --- cgi/framework.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cgi/framework.py b/cgi/framework.py index e2af143..86683dd 100644 --- a/cgi/framework.py +++ b/cgi/framework.py @@ -77,7 +77,10 @@ def addressIsTor(ip): res = True else: with open('tor.txt') as f: - nodes = [line.rstrip() for line in f] + for line in f: + if ip == line.rstrip(): + res = True + break if ip in nodes: res = True Settings._.IS_TOR = res @@ -116,9 +119,13 @@ def getCountry(ip): return "v6" else: import geoip2.database - with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader: - response = reader.country(ip) - return response.country.iso_code + import geoip2.errors + try: + with geoip2.database.Reader('GeoLite2-Country.mmdb') as reader: + response = reader.country(ip) + return response.country.iso_code + except geoip2.errors.AddressNotFoundError: + return "??" def getHost(ip): @@ -258,7 +265,10 @@ def getFormData(self): formdata = {} for key in dict(fs): - formdata.update({key: fs[key].value}) + if type(fs[key]) is list: + formdata.update({key: fs[key]}) + else: + formdata.update({key: fs[key].value}) return formdata -- cgit v1.2.1-18-gbd029