mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-02 12:22:22 +00:00
Linting fixes
This commit is contained in:
parent
b3603bc3f5
commit
c9adb7ff12
1 changed files with 13 additions and 5 deletions
|
@ -1,12 +1,20 @@
|
||||||
|
""" Logging utilities """
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class IgnoreVariableDoesNotExist(logging.Filter):
|
class IgnoreVariableDoesNotExist(logging.Filter):
|
||||||
|
"""
|
||||||
|
Filter to ignore VariableDoesNotExist errors
|
||||||
|
|
||||||
|
We intentionally pass nonexistent variables to templates a lot, so
|
||||||
|
these errors are not useful to us.
|
||||||
|
"""
|
||||||
|
|
||||||
def filter(self, record):
|
def filter(self, record):
|
||||||
if record.exc_info:
|
if record.exc_info:
|
||||||
(errType, errValue, _) = record.exc_info
|
(_, err_value, _) = record.exc_info
|
||||||
while errValue:
|
while err_value:
|
||||||
if type(errValue).__name__ == "VariableDoesNotExist":
|
if type(err_value).__name__ == "VariableDoesNotExist":
|
||||||
return False
|
return False
|
||||||
errValue = errValue.__context__
|
err_value = err_value.__context__
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue