From 22c7f309a76dcbfb60fc710f6f676700ede640d9 Mon Sep 17 00:00:00 2001 From: Johann Bauer Date: Mon, 6 May 2019 09:46:04 +0200 Subject: [PATCH] Warn if consume directory contains subdirectories . --- src/documents/consumer.py | 5 +++++ src/documents/management/commands/document_consumer.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/documents/consumer.py b/src/documents/consumer.py index 3cb484b2a..4e9f17116 100644 --- a/src/documents/consumer.py +++ b/src/documents/consumer.py @@ -94,6 +94,11 @@ class Consumer: ignored_files.append(file) else: files.append(file) + else: + self.logger.warning( + "Skipping %s as it is not a file", + entry.path + ) if not files: return diff --git a/src/documents/management/commands/document_consumer.py b/src/documents/management/commands/document_consumer.py index 6f731372f..8a6ccfcdd 100644 --- a/src/documents/management/commands/document_consumer.py +++ b/src/documents/management/commands/document_consumer.py @@ -26,6 +26,7 @@ class Command(BaseCommand): def __init__(self, *args, **kwargs): self.verbosity = 0 + self.logger = logging.getLogger(__name__) self.file_consumer = None self.mail_fetcher = None @@ -138,6 +139,11 @@ class Command(BaseCommand): file = os.path.join(directory, event.name) if os.path.isfile(file): self.file_consumer.try_consume_file(file) + else: + self.logger.warning( + "Skipping %s as it is not a file", + file + ) else: break