diff --git a/kallithea/bin/base.py b/kallithea/bin/base.py --- a/kallithea/bin/base.py +++ b/kallithea/bin/base.py @@ -108,7 +108,7 @@ class RcConf(object): def __getitem__(self, key): return self._conf[key] - def __nonzero__(self): + def __bool__(self): if self._conf: return True return False diff --git a/kallithea/lib/auth.py b/kallithea/lib/auth.py --- a/kallithea/lib/auth.py +++ b/kallithea/lib/auth.py @@ -760,7 +760,7 @@ class _PermsFunction(object): def __init__(self, *required_perms): self.required_perms = required_perms # usually very short - a list is thus fine - def __nonzero__(self): + def __bool__(self): """ Defend against accidentally forgetting to call the object and instead evaluating it directly in a boolean context, which could have security implications. diff --git a/kallithea/lib/rcmail/response.py b/kallithea/lib/rcmail/response.py --- a/kallithea/lib/rcmail/response.py +++ b/kallithea/lib/rcmail/response.py @@ -87,7 +87,7 @@ class MailBase(object): def __delitem__(self, key): del self.headers[normalize_header(key)] - def __nonzero__(self): + def __bool__(self): return self.body is not None or len(self.headers) > 0 or len(self.parts) > 0 def keys(self):