mirror of https://github.com/fail2ban/fail2ban
ENH: minor formatting, no functional changes
parent
4a83741397
commit
9339293413
|
@ -47,7 +47,8 @@ if sys.version_info >= (3,):
|
|||
return x
|
||||
def _json_loads_safe(x):
|
||||
try:
|
||||
x = json.loads(x.decode(locale.getpreferredencoding(), 'replace'))
|
||||
x = json.loads(x.decode(
|
||||
locale.getpreferredencoding(), 'replace'))
|
||||
except Exception, e: # pragma: no cover
|
||||
logSys.error('json loads failed: %s', e)
|
||||
x = {}
|
||||
|
@ -72,7 +73,8 @@ else:
|
|||
return x
|
||||
def _json_loads_safe(x):
|
||||
try:
|
||||
x = _normalize(json.loads(x.decode(locale.getpreferredencoding(), 'replace')))
|
||||
x = _normalize(json.loads(x.decode(
|
||||
locale.getpreferredencoding(), 'replace')))
|
||||
except Exception, e: # pragma: no cover
|
||||
logSys.error('json loads failed: %s', e)
|
||||
x = {}
|
||||
|
@ -406,7 +408,7 @@ class Fail2BanDb(object):
|
|||
"INSERT INTO bans(jail, ip, timeofban, data) VALUES(?, ?, ?, ?)",
|
||||
(jail.name, ticket.getIP(), int(round(ticket.getTime())),
|
||||
{"matches": ticket.getMatches(),
|
||||
"failures": ticket.getAttempt()}))
|
||||
"failures": ticket.getAttempt()}))
|
||||
|
||||
@commitandrollback
|
||||
def delBan(self, cur, jail, ticket):
|
||||
|
|
|
@ -55,7 +55,7 @@ class Ticket:
|
|||
def __eq__(self, other):
|
||||
try:
|
||||
return self.__ip == other.__ip and \
|
||||
round(self.__time,2) == round(other.__time,2) and \
|
||||
round(self.__time, 2) == round(other.__time, 2) and \
|
||||
self.__attempt == other.__attempt and \
|
||||
self.__matches == other.__matches
|
||||
except AttributeError:
|
||||
|
|
Loading…
Reference in New Issue