pycodestyle

This commit is contained in:
jonaswinkler 2021-02-06 17:21:32 +01:00
parent 9993381cda
commit 80b3fa75a5
2 changed files with 6 additions and 3 deletions

View File

@ -17,7 +17,10 @@ class LoggingMixin:
if self.logging_name: if self.logging_name:
logger = logging.getLogger(self.logging_name) logger = logging.getLogger(self.logging_name)
else: else:
name = ".".join([self.__class__.__module__, self.__class__.__name__]) name = ".".join([
self.__class__.__module__,
self.__class__.__name__
])
logger = logging.getLogger(name) logger = logging.getLogger(name)
getattr(logger, level)(message, extra={ getattr(logger, level)(message, extra={

View File

@ -312,7 +312,7 @@ class LogViewSet(ViewSet):
log_files = ["paperless", "mail"] log_files = ["paperless", "mail"]
def retrieve(self, request, pk=None, *args, **kwargs): def retrieve(self, request, pk=None, *args, **kwargs):
if not pk in self.log_files: if pk not in self.log_files:
raise Http404() raise Http404()
filename = os.path.join(settings.LOGGING_DIR, f"{pk}.log") filename = os.path.join(settings.LOGGING_DIR, f"{pk}.log")
@ -321,7 +321,7 @@ class LogViewSet(ViewSet):
raise Http404() raise Http404()
with open(filename, "r") as f: with open(filename, "r") as f:
lines = [l.rstrip() for l in f.readlines()] lines = [line.rstrip() for line in f.readlines()]
return Response(lines) return Response(lines)