Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
unified data folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Winkler committed Oct 25, 2020
1 parent d324e43 commit c596fe6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 639 deletions.
5 changes: 1 addition & 4 deletions src/documents/management/commands/document_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class Command(BaseCommand):
consumption directory, and fetch any mail available.
"""

ORIGINAL_DOCS = os.path.join(settings.MEDIA_ROOT, "documents", "originals")
THUMB_DOCS = os.path.join(settings.MEDIA_ROOT, "documents", "thumbnails")

def __init__(self, *args, **kwargs):

self.verbosity = 0
Expand Down Expand Up @@ -79,7 +76,7 @@ def handle(self, *args, **options):
except (ConsumerError, MailFetcherError) as e:
raise CommandError(e)

for d in (self.ORIGINAL_DOCS, self.THUMB_DOCS):
for d in (settings.ORIGINALS_DIR, settings.THUMBNAIL_DIR):
os.makedirs(d, exist_ok=True)

logging.getLogger(__name__).info(
Expand Down
8 changes: 2 additions & 6 deletions src/documents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,7 @@ def source_path(self):
file_name += ".gpg"

return os.path.join(
settings.MEDIA_ROOT,
"documents",
"originals",
settings.ORIGINALS_DIR,
file_name
)

Expand All @@ -222,9 +220,7 @@ def thumbnail_path(self):
file_name += ".gpg"

return os.path.join(
settings.MEDIA_ROOT,
"documents",
"thumbnails",
settings.THUMBNAIL_DIR,
file_name
)

Expand Down
Loading

0 comments on commit c596fe6

Please sign in to comment.