diff --git a/fail2ban/server/database.py b/fail2ban/server/database.py index 4e38b6ed..3ce3b2c0 100644 --- a/fail2ban/server/database.py +++ b/fail2ban/server/database.py @@ -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): diff --git a/fail2ban/server/ticket.py b/fail2ban/server/ticket.py index 329b3831..51abdc83 100644 --- a/fail2ban/server/ticket.py +++ b/fail2ban/server/ticket.py @@ -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: