aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar neptune 2022-02-21 18:24:37 -0300
committerLibravatar neptune 2022-02-21 18:24:37 -0300
commite11669559b14dfb14b40bb0a8cafb2f62dc268eb (patch)
treee21b9e32154461fae03863c2b7812dac3d65fa96
parenta16f23f034fb942b44e0665224d499af57aec1ad (diff)
downloadweabot-e11669559b14dfb14b40bb0a8cafb2f62dc268eb.tar.gz
weabot-e11669559b14dfb14b40bb0a8cafb2f62dc268eb.tar.xz
weabot-e11669559b14dfb14b40bb0a8cafb2f62dc268eb.zip
Arreglada eliminación de múltiples posts
-rw-r--r--cgi/framework.py20
1 files 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